title: No bean resolver registered in the context to resolve access to bean
body: <p>I'm trying to implement method security using Java Config, but I'm getting a error:-</p>
  
  <pre><code>org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'appPermissionEvaluator'
  </code></pre>
  
  <p>The method is:-</p>
  
  <pre><code>@PreAuthorize("@appPermissionEvaluator.hasSystemPermission()")
  public String something() {
      ...
  }
  </code></pre>
  
  <p>The Config class definition is (MethodSecurityConfig.java):-</p>
  
  <pre><code>@Configuration
  @EnableGlobalMethodSecurity(prePostEnabled = true)
  public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
  
      @Bean
      public AppPermissionEvaluator appPermissionEvaluator() {
          return new AppPermissionEvaluator();
      }
  
      @Override
      protected MethodSecurityExpressionHandler createExpressionHandler() {
          DefaultMethodSecurityExpressionHandler expressionHandler =
                  new DefaultMethodSecurityExpressionHandler();
          expressionHandler.setPermissionEvaluator(appPermissionEvaluator());
          return expressionHandler;
      }
  
      ...
  }
  </code></pre>
  
  <p>I checked that I'm able to autowire the bean in the same class, also I found the default hasPermission() methods are working as I've implemented them, the only problem is reading the bean from SpEL. I'm not sure what's wrong. Any Pointers?</p>
  
  <p>I'm using Spring 4.1.5 and Spring security 3.2.7</p>