title: Issues about understanding Spring AOP when weaving a class with no Interface and non public method
body: <p>I am learning Spring AOP and i have created a simple project in order to understand how it works. Please find below the main part of my project:</p>
  
  <p>My Spring-Customer.xml</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:aop="http://www.springframework.org/schema/aop"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/aop 
      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd "&gt;
  
      &lt;aop:aspectj-autoproxy /&gt;
  
  
  
      &lt;bean id="customerBoNoIterface" class="com.core.CustomerBoNoIterface" /&gt;
  
  
      &lt;!-- Aspect --&gt;
      &lt;bean id="logAspect" class="com.aspect.LoggingAspect" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Please find below my AOP pointcut:</p>
  
  <pre><code>@Before("execution(* com.core.CustomerBoNoIterface.addCustmer*(..))")
      public void logBeforeDummy(JoinPoint joinPoint) {
  
          System.out.println("hijacked : " + joinPoint.getSignature().getName());
          System.out.println("******");
      }
  </code></pre>
  
  <p>Please find below my class CustomerBoNoIterface:</p>
  
  <pre><code>   public class CustomerBoNoIterface {
  
      private void addCustmerPrivate() {
          System.out.println("calling addCustmerPrivate()");
      }
  
      public void addCustmerPublic() {
  
          System.out.println("calling addCustmerPublic()");
  
      }
  
      protected void addCustmerProtected() {
  
          System.out.println("calling addCustmerProtected()");
  
      }
  
      void addCustmerDefault() {
  
          System.out.println("calling addCustmerDefault()");
  
      }
  
  
  
      public String addCustmerReturnString() {
  
          System.out.println("calling addCustmerPublic return string");
          return "";
  
      }
  
  }
  </code></pre>
  
  <p>And finally my Main method:</p>
  
  <pre><code>public class App {
      public static void main(String[] args) throws Exception {
  
          ApplicationContext appContext = new ClassPathXmlApplicationContext("Spring-Customer.xml");
  
          CustomerBoNoIterface customerBoNoIterfaceBean =appContext.getBean("customerBoNoIterface", CustomerBoNoIterface.class);
          customerBoNoIterfaceBean.addCustmerPublic();
          customerBoNoIterfaceBean.addCustmerDefault();
          customerBoNoIterfaceBean.addCustmerProtected();
          customerBoNoIterfaceBean.addCustmerReturnString();
  
  
  
      }
  </code></pre>
  
  <p>According to the on line reference Spring AOP is done by proxy and a class needs to implement an interface in order for Spring to be able to weave the aspect and also Spring will weave aspect to public method only.</p>
  
  <p>However in my case i have a class with no interface as shown in the above example and i am able to  apply AOP in following method:</p>
  
  <pre><code>            customerBoNoIterfaceBean.addCustmerPublic();
          customerBoNoIterfaceBean.addCustmerDefault();
          customerBoNoIterfaceBean.addCustmerProtected();
          customerBoNoIterfaceBean.addCustmerReturnString();
  </code></pre>
  
  <p>So when i run the Main method i get the following output in my console in eclipse:</p>
  
  <pre><code>hijacked : addCustmerPublic
  ******
  calling addCustmerPublic()
  hijacked : addCustmerDefault
  ******
  calling addCustmerDefault()
  hijacked : addCustmerProtected
  ******
  calling addCustmerProtected()
  hijacked : addCustmerReturnString
  ******
  calling addCustmerPublic return string
  </code></pre>
  
  <p>So I am not able to understand how Spring is able to weave aspect in methods other than public and also a class with no interface?</p>
  
  <p>Thanks in advance,</p>