<aop:declare-parents
types-matching="com.itany.service.IPersonService+"
implement-interface="com.itany.service.IIntroduceService"
default-impl="com.itany.service.impl.IIntroduceServiceImpl"/>
说明:
- 配置在<aop:aspect>标签下</aop:aspect>
- types-matching:匹配需要引入接口的目标对象表达式;
- implement-interface:定义需要引入的接口;
- default-impl和delegate-ref:定义引入接口的默认实现,二选一
实例:
ApplicationContext act=new ClassPathXmlApplicationContext("beans.xml");
IIntroduceService introduceService = (IIntroduceService) act.getBean("personService");
introduceService.introduce("testintroduce");
((IPersonService) introduceService).save();
从理解上来讲,看认为这个配置实现了introduceService继承了personService
时间: 2024-10-20 05:14:16