id 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();
}
}
|