-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
29 lines (22 loc) · 1.13 KB
/
Application.java
File metadata and controls
29 lines (22 loc) · 1.13 KB
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
29
import com.ab.service.SpeakerService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Arpit Bhardwaj
*/
public class Application {
public static void main(String[] args) {
//This is the hardcoded injection need to do if we don't use Spring
//SpeakerService service = new SpeakerServiceImpl();
//to activate xml based configuration
//ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//to activate java based configuration
ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
SpeakerService service = context.getBean("speakerService",SpeakerService.class);
System.out.println(service.findAll().get(0).getFirstName());
System.out.println(service.findAll().get(0).getSeedNum());
//SpeakerService service2 = context.getBean("speakerService",SpeakerService.class);
//System.out.println(service2);
}
}