Bean initialisation, PreAuthorize and GlobalAuthenticationConfigurerAdapter
<p>follow configuration is not work, since i have used the @PreAuthorize annotation.
I would like to inject a service in my own AuthenticationProvider. If my service not use the @PreAuthorize annotation, it will work. If i use this annotation, the "my service " bean will be null at the "MyGlobalAuthenticationConfigurerAdapter", because when the my service bean is created the authentification provider is created too (to early). So what can i do?</p>

<p>MyService:</p>

<pre><code>interface MyService{
@PreAuthorize()
void foo(){

}
</code></pre>

<p>Config 1:</p>

<pre><code>@Configuration
@ComponentScan
@EnableAutoConfiguration
public class MyConfiguration {

    @Bean
    public MyService myService() {
        return new MyServiceimpl();
    }
</code></pre>

<p>Config2:</p>

<pre><code>@Configuration
@ComponentScan
@EnableAutoConfiguration
@Order(Ordered.HIGHEST_PRECEDENCE)
public class MyGlobalAuthenticationConfigurerAdapter extends GlobalAuthenticationConfigurerAdapter {

    @Autowired
    private MyService myService;

    @Override
    public void configure(final AuthenticationManagerBuilder auth) throws Exception {
        final MyAuthenticationProvider myAuthenticationProvider = myAuthenticationProvider ();
        auth.authenticationProvider(myAuthenticationProvider );
    }

    @Bean
    public MyAuthenticationProvider myAuthenticationProvider () {
        return new MyAuthenticationProvider (myService);
    }
</code></pre>