title: How to mix CGLIB and JDK proxies in Spring configuration files?
body: <p>This thread is related to a problem I am encountering <a href="https://stackoverflow.com/q/10110253/827480">here regarding the needs for access to protected methods of an advised class</a>.  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.  </p>
  
  <p>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.</p>
  
  <p>I am using a mix of annotations and xml configuration, but this particular aspect is defined in XML configuration.</p>
  
  <p>I know that there is <code>&lt;aop:scoped-proxy&gt;</code> tag, but from what I can tell, that applies to all aspects.  </p>
  
  <p>Is there anyway to define for a single aspect to use CGLIB instead?</p>
  
  <pre><code>&lt;aop:config&gt;
      &lt;aop:aspect id="Profiler" ref="lendingSimulationServiceProfilerInterceptor"&gt;
          &lt;!-- info --&gt;
          &lt;aop:around method="infoProfiler"
                      pointcut="execution(* com.cws.cs.lendingsimulationservice.service.LendingSimulationServiceImpl.calculate*(..))"  /&gt;
  
          &lt;!-- debug --&gt;
          &lt;aop:around method="infoProfiler"
                      pointcut="execution(* com.cws.cs.lendingsimulationservice.process.LendingSimulationProcessImpl.calculate(..))"  /&gt;
  
          &lt;aop:around method="infoProfiler"
                      pointcut="execution(* com.blaze.BlazeEngine.invokeService(..))"  /&gt;
  
          &lt;!-- trace --&gt;
          &lt;aop:around method="traceProfiler" 
                      pointcut="execution(* com.calculator.dao.impl.LendingSimulationDaoImpl.*(..))"  /&gt;
  
          &lt;!-- NEED TO DEFINE THIS PARTICULAR ASPECT AS CGLIB --&gt;
          &lt;aop:around method="traceProfiler" 
                      pointcut="execution(* com.cws.cs.lendingsimulationservice.util.pool.JAXBPoolImpl.*(..))"    /&gt;
      &lt;/aop:aspect&gt;
  &lt;/aop:config&gt;
  </code></pre>
  
  <p>I've tried to split the configuration into two, and for one configuration specify <code>target-class="true"</code> and the other <code>target-class="false"</code>, but it seems to apply CGLIB to all at that point.</p>
  
  <p>Is there any way to accomplish this?</p>
  
  <p>Thanks,</p>
  
  <p>Eric</p>