title: Required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found. message from spring security
body: <p>I am trying to implement one sample demo for Spring Security with Spring Boot for checking the authentication. I am trying to implement a basic workout for Spring Security and getting the following message,</p>
  
  <pre><code>Description:
  
  Parameter 0 of constructor in com.spacestudy.service.CustomAuthenticationProvider required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
  
  Action:
  
  Consider defining a bean of type 'org.springframework.security.web.AuthenticationEntryPoint' in your configuration.
  </code></pre>
  
  <p>My security config class SecurityConfig.java,</p>
  
  <pre><code>@EnableWebSecurity
  @Configuration
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
  @Autowired
  private AuthenticationEntryPoint authEntryPoint;
  
   @Override
      protected void configure(HttpSecurity http) throws Exception {
          http
          .csrf().disable()
          .authorizeRequests()
          .anyRequest().authenticated()
          .and()
          .addFilter(new ApplicationContextHeaderFilter((ApplicationContext) authenticationManager()));
      }
  }
  </code></pre>
  
  <p>And my BasicAuthenticationFilter implementation like the following,</p>
  
  <pre><code>@Component
  public class  CustomAuthenticationProvider  extends  BasicAuthenticationFilter    { 
  
  public CustomAuthenticationProvider(AuthenticationManager authenticationManager) {
      super(authenticationManager);
      // TODO Auto-generated constructor stub
  }
  @Override
  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
      UsernamePasswordAuthenticationToken authentication = getAuthentication(request);
      SecurityContextHolder.getContext().setAuthentication(authentication);
      filterChain.doFilter(request, response);
  }
  private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request) {
     String bearerToken = request.getHeader("accessToken");
  String username = "test";
  String password = "test";
      if (username != null &amp;&amp; !username.isEmpty()) {
          return new UsernamePasswordAuthenticationToken(username, null, null);
        }
      return null;
      }
   }
  </code></pre>
  
  <p>How can I resolve this issue?</p>