File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import org .springframework .context .annotation .Bean ;
4
4
import org .springframework .context .annotation .Configuration ;
5
+ import org .springframework .context .annotation .Primary ;
5
6
6
7
import es .lanyu .Test ;
7
8
8
9
@ Configuration
9
10
public class JavaConfig {
10
11
11
- @ Bean (name ="config" )
12
+ @ Bean //(name="config")
13
+ @ Primary
12
14
public Test miTest () {
13
15
Test test = new Test () {
14
16
int llamadas = 0 ;
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ public class TestAutowired extends Test {
18
18
Test testInyectado ;
19
19
20
20
@ Autowired
21
- private void setTestInyectado (@ Qualifier ("config" ) Test testPorSetter ,
22
- @ Qualifier ("test" ) Test testPorSetter2 ) {
23
- testInyectado = new Test ();
24
- testInyectado .setTestString (testPorSetter .getTestString ()
25
- + " y " + testPorSetter2 .getTestString ());
21
+ private void setTestInyectado (//@Qualifier("config") Test testPorSetter,
22
+ @ Qualifier ("test" ) Test testPorSetter2 ,
23
+ Test testPrincipal ) {
24
+ testInyectado = testPrincipal ;
25
+ // testInyectado = new Test();
26
+ // testInyectado.setTestString(testPorSetter.getTestString()
27
+ // + " y " + testPorSetter2.getTestString());
26
28
}
27
29
28
30
@ Autowired (required =false )
You can’t perform that action at this time.
0 commit comments