This thread is related to a problem I am encountering here regarding the needs for access to protected methods of an advised class. I'm using Spring 3.0.6, and have created a Spring profiling aspect that I am applying to a significant number of beans using JDK proxies.
However, due to the need to access protected methods in one particular bean, I would like to advise it using CGLIB. All other beans I would like to continue to use JDK Proxies.
I am using a mix of annotations and xml configuration, but this particular aspect is defined in XML configuration.
I know that there is <aop:scoped-proxy>
tag, but from what I can tell, that applies to all aspects.
Is there anyway to define for a single aspect to use CGLIB instead?
<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>
I've tried to split the configuration into two, and for one configuration specify target-class="true"
and the other target-class="false"
, but it seems to apply CGLIB to all at that point.
Is there any way to accomplish this?
Thanks,
Eric
@Scope( proxyMode = ScopedProxyMode.TARGET_CLASS )
it doesn't seem to work for me. – Entremets