Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration : <p>I followed few suggestions mentioned here, but it didn't work for me. Hence, putting the question here</p>

<ol>
<li><a href="https://stackoverflow.com/questions/21633555/how-to-inject-authenticationmanager-using-java-configuration-in-a-custom-filter/21639553#21639553">How To Inject AuthenticationManager using Java Configuration in a Custom Filter</a></li>
<li><a href="https://stackoverflow.com/questions/49473634/spring-required-a-bean-of-type-authenticationmanager">Spring required a bean of type &#39;AuthenticationManager&#39;</a></li>
</ol>

<p>Could anyone please guide me what's the issue and how to fixed that ?</p>

<p><strong>Error:</strong></p>

<pre><code>***************************
APPLICATION FAILED TO START
***************************

Description:

Field authenticationManager in com.techprimers.security.springsecurityauthserver.config.AuthorizationServerConfig 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.authentication.AuthenticationManager' in your configuration.
</code></pre>

<p><strong>AuthorizationServerConfig.java</strong></p>

<pre><code>@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {

    @Autowired
    private AuthenticationManager authenticationManager;

    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {

        security.tokenKeyAccess("permitAll()")
                .checkTokenAccess("isAuthenticated()");
    }


    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients
                .inMemory()
                .withClient("ClientId")
                .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>ResourceServerConfig.java</strong></p>

<pre><code>@EnableResourceServer
@Configuration
public class ResourceServerConfig extends WebSecurityConfigurerAdapter {


    @Autowired
    @Qualifier("authenticationManagerBean")
    private AuthenticationManager authenticationManager;
    @Autowired
    private UserDetailsService customUserDetailsService;

    @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)
                .userDetailsService(customUserDetailsService);
    }
}
</code></pre>

<p>The code reference taken from <a href="https://github.com/TechPrimers/spring-security-oauth-mysql-example" rel="noreferrer">https://github.com/TechPrimers/spring-security-oauth-mysql-example</a>, only updated Spring Boot Parent Version to <code>2.0.4.RELEASE</code>, things started breaking.</p>
