7.2.5:测试代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
public class TestAOP { @Test public void testAop2() { //cglib动态代理 ApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml" ); TestService testProxy = context.getBean( "testProxy" , TestService. class ); System.out.println(testProxy.getClass().getName()); System.out.println(testProxy.getClass().getSuperclass().getName()); testProxy.test(); } @Test public void testAop() { //jdk动态代理 ApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml" ); UserService userService = context.getBean( "proxy" , UserService. class ); System.out.println(userService.getClass().getName()); userService.demo(); } } |