-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyApp.java
More file actions
28 lines (20 loc) · 861 Bytes
/
MyApp.java
File metadata and controls
28 lines (20 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package code;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MyApp {
public static void main(String[] args) {
// load the spring configuration file
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
// retrieve bean from spring container
CricketCoach theCoach = context.getBean("myCricketCoach", CricketCoach.class);
// call methods on the bean
// ... let's come back to this ...
System.out.println(theCoach.getDailyWorkout());
System.out.println(theCoach.getDailyFortune());
// call our new methods to get the literal values
System.out.println(theCoach.getEmailAddress());
System.out.println(theCoach.getTeam());
// close the context
context.close();
}
}