【发布时间】:2012-04-11 17:01:25
【问题描述】:
此线程与我遇到的问题here regarding the needs for access to protected methods of an advised class 有关。我正在使用 Spring 3.0.6,并创建了一个 Spring 分析方面,我将其应用于使用 JDK 代理的大量 bean。
但是,由于需要访问某个特定 bean 中的受保护方法,我建议使用 CGLIB。我想继续使用 JDK 代理的所有其他 bean。
我混合使用了注解和 xml 配置,但这个特定方面是在 XML 配置中定义的。
我知道有<aop:scoped-proxy> 标签,但据我所知,这适用于所有方面。
有没有定义一个单一的方面来代替使用CGLIB?
<aop:config>
<aop:aspect id="Profiler" ref="lendingSimulationServiceProfilerInterceptor">
<!-- info -->
<aop:around method="infoProfiler"
pointcut="execution(* com.cws.cs.lendingsimulationservice.service.LendingSimulationServiceImpl.calculate*(..))" />
<!-- debug -->
<aop:around method="infoProfiler"
pointcut="execution(* com.cws.cs.lendingsimulationservice.process.LendingSimulationProcessImpl.calculate(..))" />
<aop:around method="infoProfiler"
pointcut="execution(* com.blaze.BlazeEngine.invokeService(..))" />
<!-- trace -->
<aop:around method="traceProfiler"
pointcut="execution(* com.calculator.dao.impl.LendingSimulationDaoImpl.*(..))" />
<!-- NEED TO DEFINE THIS PARTICULAR ASPECT AS CGLIB -->
<aop:around method="traceProfiler"
pointcut="execution(* com.cws.cs.lendingsimulationservice.util.pool.JAXBPoolImpl.*(..))" />
</aop:aspect>
</aop:config>
我尝试将配置一分为二,一个配置指定target-class="true",另一个指定target-class="false",但此时似乎对所有配置都应用了CGLIB。
有没有办法做到这一点?
谢谢,
埃里克
【问题讨论】:
标签: java spring aop cglib proxies