File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/main/java/spring_java_annotation_based_di Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 12
12
public class MainAppForDemoJavaAnnotationBasedDI {
13
13
14
14
public static void main (String [] args ) {
15
- AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ();
15
+ AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext ();
16
16
17
- ctx .register (Gospel1Config .class , TextEditorConfig .class ,
17
+ annotationConfigApplicationContext .register (Gospel1Config .class , TextEditorConfig .class ,
18
18
HelloWorldConfig .class );
19
- ctx .refresh ();
19
+ annotationConfigApplicationContext .refresh ();
20
20
21
- Gospel1 luke = ctx .getBean (Gospel1 .class );
21
+ Gospel1 luke = annotationConfigApplicationContext .getBean (Gospel1 .class );
22
22
luke .setReflection ("Gospel 1 is the book of Luke!" );
23
23
System .out .println (luke .getReflection ());
24
24
25
- TextEditor te = ctx .getBean (TextEditor .class );
25
+ TextEditor te = annotationConfigApplicationContext .getBean (TextEditor .class );
26
26
te .spellCheck ();
27
27
28
- HelloWorld hw = ctx .getBean (HelloWorld .class );
28
+ HelloWorld helloWorld = annotationConfigApplicationContext .getBean (HelloWorld .class );
29
+ helloWorld .setMessage ("Hello World!" );
30
+ helloWorld .getMessage ();
29
31
30
32
System .out .println ("The program ends!" );
31
33
}
You can’t perform that action at this time.
0 commit comments