是这样的,我有个工程,有很多的类,我需要对每一个类的每一个方法进行织入,所以需要在xml中进行配置,请问有没有办法不用在xml中编写每一个bean呢,比如类似通过pattern
我从下面的网址下载了一个代码片段
http://www.mkyong.com/spring3/spring-aop-aspectj-in-xml-configuration-example/
其中的例子是这样的:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd ">
expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomer(..))" />
expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomer(..))" />
expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomerReturnValue(..))" />
pointcut-ref="pointCutAfterReturning" />
expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomerThrowException(..))" />
pointcut-ref="pointCutAfterThrowing" />
expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomerAround(..))" />
/aop:aspect
如上面的代码片段:
customerBo这个bean是在这里配置的,那如果我有几十个bean的话(不想用interface,因为还需要定义),就需要写几十个配置,有没有办法通过包名,或者类似pattern的方式实现呢