该线程与我在这里遇到的一个问题有关,即需要访问建议类的受保护方法。我正在使用 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 应用于所有配置。
有没有办法做到这一点?
谢谢,
埃里克