当前位置: 首页 > 知识库问答 >
问题:

配置类中的构造函数参数需要“StratusAuthenticationEntryPoint”类型的bean,但找不到该bean

韦思淼
2023-03-14

ResourceServerConfiguration中构造函数的参数0需要类型为“StratusAuthenticationEntryPoint”的bean,但找不到该bean。

我使用的是spring boot 2.6.6,代码如下:

@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;
    }
}

错误消息:

            ***************************
        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.

共有1个答案

欧阳君浩
2023-03-14

> < li>

在spring ioc创建的bean的< code > StratusAuthenticationEntryPoint 类上添加@Component

验证ComponentScan路径是否包含StratusAuthentiationEntryPoint的类

 类似资料: