title: How exactly Spring use JDK proxy?
body: <p>I have some doubts related the 2 kinds of proxies that I can use with Spring.</p>
  
  <p><img src="https://i.stack.imgur.com/tzEiO.jpg" alt="enter image description here"></p>
  
  <p>So, from what I have understand the <strong>JDK proxy</strong> type is the default one used from Spring and is based on the interface implementation.</p>
  
  <p>From what I have understand (but I am absolutly not sure about this assertion, correct me if it is wrong) using the <strong>JDK proxy</strong> both the class of the object "wrapped" by the proxy and the proxy itself have to implement an interface.</p>
  
  <p>What exactly represent this interface? As any interface it contains not implemented methods declaration. What method are?</p>
  
  <p>Studying on the online documentation I found this link: <a href="http://docs.spring.io/autorepo/docs/spring/3.2.3.RELEASE/javadoc-api/org/springframework/context/annotation/EnableAspectJAutoProxy.html" rel="nofollow noreferrer">http://docs.spring.io/autorepo/docs/spring/3.2.3.RELEASE/javadoc-api/org/springframework/context/annotation/EnableAspectJAutoProxy.html</a></p>
  
  <p>Here it is shown an example of the <strong>JDK proxy</strong> use for AOP behavior but I have some doubts related the previous interface use.</p>
  
  <p>So, as you can see in this link, there are:</p>
  
  <ol>
  <li><p>The <strong>AppConfig</strong> configuration class</p>
  
  <pre><code> @Configuration
   @EnableAspectJAutoProxy
   public class AppConfig {
       @Bean
       public FooService fooService() {
           return new FooService();
       }
  
       @Bean
       public MyAspect myAspect() {
           return new MyAspect();
       }
   }
  </code></pre></li>
  </ol>
  
  <p>I think that <strong>@EnableAspectJAutoProxy</strong> enable the use of <strong>JDK proxy</strong> for adding aspect behavior (is it true?)</p>
  
  <p>In this class are definied 2 beans <strong>FooService</strong> and <strong>MyAspect</strong>.</p>
  
  <ol start="2">
  <li><strong>FooService</strong> that is a typical POJO component:</li>
  </ol>
  
  <p>public class FooService {
       // various methods
  }</p>
  
  <ol start="3">
  <li><p><strong>MyAspect</strong> that is an @Aspect-style aspect:</p>
  
  <p>@Aspect
   public class MyAspect {
       @Before("execution(* FooService+.*(..))")
       public void advice() {
           // advise FooService methods as appropriate
       }
    }</p></li>
  </ol>
  
  <p>In the scenario above, @EnableAspectJAutoProxy ensures that MyAspect will be properly processed and that <strong>FooService will be proxied</strong> mixing in the advice that it contributes.</p>
  
  <p>So my doubts are: if the <strong>FooService</strong> bean is proxied why it don't explicitly implement any interface as (I think) have to be a JDK proxy? What am I missing?</p>
  
  <p>Tnx </p>