Skip to content

Commit 8b08c3a

Browse files
update variable names
1 parent 6e62d54 commit 8b08c3a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/spring_java_annotation_based_di/MainAppForDemoJavaAnnotationBasedDI.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@
1212
public 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
}

0 commit comments

Comments
 (0)