-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
31 lines (25 loc) · 1.13 KB
/
Main.java
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
30
31
import config.SpringConfig;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import pack.*;
public class Main{
public static void main(String[] args){
ApplicationContext springContext = null;
try {
springContext = new AnnotationConfigApplicationContext(SpringConfig.class);
} catch (BeansException e) {
}
System.out.println("context: " + springContext);
System.out.println("beans for SomeInterface: " + springContext.getBeansOfType(SomeInterface.class));
System.out.println("beans for SomeClass: " + springContext.getBean(SomeClass.class));
Object bean = null;
try{
bean = springContext.getBean(SomeClassWithTransactional.class);
}
catch (Exception e){
}
System.out.println("beans for SomeClassWithTransactional : " + bean);
System.out.println("beans for SomeClassWithTransactionalAndProxyMode: " + springContext.getBean(SomeClassWithTransactionalAndProxyMode.class));
}
}