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 1212public class MainAppForDemoJavaAnnotationBasedDI {
1313
1414 public static void main (String [] args ) {
15- AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ();
15+ AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext ();
1616
17- ctx .register (Gospel1Config .class , TextEditorConfig .class ,
17+ annotationConfigApplicationContext .register (Gospel1Config .class , TextEditorConfig .class ,
1818 HelloWorldConfig .class );
19- ctx .refresh ();
19+ annotationConfigApplicationContext .refresh ();
2020
21- Gospel1 luke = ctx .getBean (Gospel1 .class );
21+ Gospel1 luke = annotationConfigApplicationContext .getBean (Gospel1 .class );
2222 luke .setReflection ("Gospel 1 is the book of Luke!" );
2323 System .out .println (luke .getReflection ());
2424
25- TextEditor te = ctx .getBean (TextEditor .class );
25+ TextEditor te = annotationConfigApplicationContext .getBean (TextEditor .class );
2626 te .spellCheck ();
2727
28- HelloWorld hw = ctx .getBean (HelloWorld .class );
28+ HelloWorld helloWorld = annotationConfigApplicationContext .getBean (HelloWorld .class );
29+ helloWorld .setMessage ("Hello World!" );
30+ helloWorld .getMessage ();
2931
3032 System .out .println ("The program ends!" );
3133 }
You can’t perform that action at this time.
0 commit comments