title: FileNotFoundException: class path resource ***/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
body: <p>I have following dependencies:</p>
  
  <pre><code>compile('org.springframework.boot:spring-boot-starter-web')
  testCompile('org.springframework.boot:spring-boot-starter-test')
  compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.0.2.RELEASE'
  </code></pre>
  
  <p>and following sources(copiesd from <a href="http://www.baeldung.com/sso-spring-security-oauth2" rel="noreferrer">http://www.baeldung.com/sso-spring-security-oauth2</a>):</p>
  
  <p><strong>main:</strong></p>
  
  <pre><code>@SpringBootApplication
  @EnableResourceServer
  public class AuthorizationServerApplication extends SpringBootServletInitializer {
      public static void main(String[] args) {
          SpringApplication.run(AuthorizationServerApplication.class, args);
      }
  }
  </code></pre>
  
  <p><strong>AuthServerConfig:</strong></p>
  
  <pre><code>@Configuration
  @EnableAuthorizationServer
  public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {
      @Autowired
      private AuthenticationManager authenticationManager;
  
      @Override
      public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
          oauthServer.tokenKeyAccess("permitAll()")
                  .checkTokenAccess("isAuthenticated()");
      }
  
      @Override
      public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
          clients.inMemory()
                  .withClient("SampleClientId")
                  .secret("secret")
                  .authorizedGrantTypes("authorization_code")
                  .scopes("user_info")
                  .autoApprove(true) ;
      }
  
      @Override
      public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
          endpoints.authenticationManager(authenticationManager);
      }
  }
  </code></pre>
  
  <p><strong>SecurityConfig:</strong></p>
  
  <pre><code>@Configuration
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private AuthenticationManager authenticationManager;
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.requestMatchers()
                  .antMatchers("/login", "/oauth/authorize")
                  .and()
                  .authorizeRequests()
                  .anyRequest().authenticated()
                  .and()
                  .formLogin().permitAll();
      }
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth.parentAuthenticationManager(authenticationManager)
                  .inMemoryAuthentication()
                  .withUser("john").password("123").roles("USER");
      }
  }
  </code></pre>
  
  <p><strong>UserController:</strong></p>
  
  <pre><code>@RestController
  public class UserController {
      @GetMapping("/user/me")
      public Principal user(Principal principal) {
          return principal;
      }
  }
  </code></pre>
  
  <p>When I start application I see following:</p>
  
  <pre><code>2018-04-12 17:19:58.153  WARN 16828 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.my.sso.server.AuthServerConfig]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
  2018-04-12 17:19:58.449 ERROR 16828 --- [           main] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.my.sso.server.AuthServerConfig]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
      at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:645) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:300) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:194) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:293) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at com.my.sso.server.AuthorizationServerApplication.main(AuthorizationServerApplication.java:12) [classes/:na]
  Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
      at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.core.type.classreading.SimpleMetadataReader.&lt;init&gt;(SimpleMetadataReader.java:51) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:88) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:75) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
      at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:731) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:947) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:330) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:359) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:265) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:635) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      ... 20 common frames omitted
  </code></pre>
  
  <p>What do I wrong?</p>
  
  <p><strong>P.S.</strong><br>
  I found this classes in libraries but in another package:</p>
  
  <pre><code>org.springframework.security.config.annotation.authentication.configuration
  </code></pre>
  
  <p>but spring tries to find it in the package: </p>
  
  <pre><code>org.springframework.security.config.annotation.authentication.configurers
  </code></pre>