Spring学习笔记之aop动态代理(3) 1.0 静态代理模式的缺点: 1.在该系统中有多少的dao就的写多少的proxy,麻烦 2.如果目标接口有方法的改动,则proxy也需要改动. PersonDao.java public interface PersonDao { public void savePerson(); } PersonDaoImpl.java public class PersonDaoImpl implements PersonDao{ public void save…
spring.handlers http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler public class AopNamespaceHandler extends NamespaceHandlerSupport { public void init() { // In 2.0 XSD as well as in 2.1 XSD. registerBeanDef…
动态代理原理:spring AOP采用动态代理来实现 (1)定义一个接口Boy package aop001; public interface Boy { public void beat(String time); public void play(String time); } (2)定义两个类实现Boy接口: Boy_1 package aop001; public class Boy_1 implements Boy { @Override public void beat(Strin…