'Constructor parameter in configuration class required a bean of type 'StratusAuthenticationEntryPoint' that could not be found

Parameter 0 of constructor in ResourceServerConfiguration required a bean of type 'StratusAuthenticationEntryPoint' that could not be found.

I am using spring boot 2.6.6 Here is the code:

@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Order(100)
//@Import({ApiPermissionEvaluator.class})
public class ResourceServerConfiguration extends WebSecurityConfigurerAdapter {

    private final StratusAuthenticationEntryPoint securityAuthenticationEntryPoint;

    public ResourceServerConfiguration(StratusAuthenticationEntryPoint securityAuthenticationEntryPoint) {
        super();
        this.securityAuthenticationEntryPoint = securityAuthenticationEntryPoint;
    }
}

error message:

            ***************************
        APPLICATION FAILED TO START
        ***************************

        Description:

        Parameter 0 of constructor in com.stratus.security.config.ResourceServerConfiguration required a bean of type 'com.stratus.security.config.StratusAuthenticationEntryPoint' that c
        ould not be found.


        Action:

        Consider defining a bean of type 'com.stratus.security.config.StratusAuthenticationEntryPoint' in your configuration.


Solution 1:[1]

  1. Add @Component over Class of StratusAuthenticationEntryPoint that a bean created by spring ioc

  2. verify if the ComponentScan path contains Class of StratusAuthenticationEntryPoint

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P