title: Spring boot + Spring security with AspectJ not working
body: <p>I am trying to configure spring global method security with AspectJ advice mode so I can use <code>@PreAuthorize</code> annotations in all <code>@Configurable</code> annotated classes. This my java configs:</p>
  
  <pre><code>@Configuration
  @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true, mode = AdviceMode.ASPECTJ)
  public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>@EnableCaching
  @SpringBootApplication
  @EnableSpringConfigured
  @EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
  @EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.ENABLED)
  public class WebApplication extends WebMvcConfigurerAdapter 
  </code></pre>
  
  <p>This is my <code>@Configurable</code> class:</p>
  
  <pre><code>@Configurable
  public class Entity {
      @PreAuthorize("hasPermission(this, 'publish')")
      public void method() { }
  }
  </code></pre>
  
  <p>I also added spring-security-aspects as dependency. From AspectJ logs I can clearly see that Spring security related aspects are applied on my <code>@Configurable</code> classes however as soon as I create instance of these classes I get this exception:</p>
  
  <pre><code>Post-processor tried to replace bean instance of type [com.example.Entity] with (proxy) object of type [com.sun.proxy.$Proxy130] - not supported for aspect-configured classes!
  </code></pre>
  
  <p>I am using spring boot version 1.2.1 therefore spring security version is 3.2.5 . This seems to be bug that was discussed here : <a href="https://stackoverflow.com/questions/25207933/spring-security-aspectjmode-with-enableglobalmethodsecurity-not-working">Spring Security AspectJMode with @EnableGlobalMethodSecurity not working</a></p>
  
  <p>However this bug should not affect my version of spring security... Is there any workaround for this issue?</p>