title: A component required a bean of type ObjectPostProcessor that could not be found
body: <p>I have configured oauth in my spring boot application and when i try to run my project main class application fails to start stating that:</p>
  
  <pre><code>'A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
  </code></pre>
  
  <p>I have referred few similar Stack Overflow questions and answers but still didn't found any solution.</p>
  
  <p>This is the <code>WebSecurityConfiguration</code> class that i added:</p>
  
  <pre><code>@EnableOAuth2Sso
  @Configuration
  public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter{
       @Override
           protected void configure(HttpSecurity http) throws Exception 
  {
              http
                      .csrf()
                          .disable()
                      .antMatcher("/**")
                      .authorizeRequests()
                      .antMatchers("/", "/index.html")
                          .permitAll()
                      .anyRequest()
                          .authenticated();
          }
  
  
  }
  </code></pre>
  
  <p>These are my <code>pom.xml</code> dependencies:</p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
          &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
        &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;version&gt;1.4.1.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
      &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
      &lt;version&gt;5.1.5.RELEASE&lt;/version&gt;
       &lt;/dependency&gt;
       &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
          &lt;version&gt;5.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;           
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security.oauth&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-oauth2&lt;/artifactId&gt;
          &lt;version&gt;2.0.11.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-security&lt;/artifactId&gt;
          &lt;version&gt;1.1.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>This is my main class</p>
  
  <pre><code>@SpringBootApplication
  public class Application {
  
  public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
  }
  
  @Bean
  public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
      return args -&gt; {
  
          System.out.println("Let's inspect the beans provided by Spring Boot:");
  
          String[] beanNames = ctx.getBeanDefinitionNames();
          Arrays.sort(beanNames);
          for (String beanName : beanNames) {
              System.out.println(beanName);
          }
  
      };
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When i try to run main class it gives the following error:</p>
  
  <p>Description:</p>
  
  <pre><code>A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
  </code></pre>
  
  <p>Action:</p>
  
  <pre><code>Consider defining a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' in your configuration.
  </code></pre>