小编Дам*_*нов的帖子

考虑在您的配置中定义一个类型为 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' 的 bean

我正在尝试将 jwt 令牌连接到我的项目,在工作期间我遇到了一些问题。我已经按照这里提到的说明进行操作,但我有错误。我试图用这些人的同样问题来修复它,但它对我不起作用。我想,我错过了一些东西。

谁能帮帮我,谢谢。

错误:

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

Description:

Parameter 1 of constructor in com.example.demo.security.WebSecurity required a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' in your configuration.

Run Code Online (Sandbox Code Playgroud)

网络安全.java

@EnableWebSecurity
public class WebSecurity extends WebSecurityConfigurerAdapter {
    private AppUserDetailsService appUserDetailsService;
    private BCryptPasswordEncoder bCryptPasswordEncoder;

    public WebSecurity(AppUserDetailsService appUserDetailsService, BCryptPasswordEncoder bCryptPasswordEncoder) {
        this.appUserDetailsService = appUserDetailsService;
        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.cors().and().csrf().disable().authorizeRequests() …
Run Code Online (Sandbox Code Playgroud)

spring spring-security spring-boot

3
推荐指数
1
解决办法
7563
查看次数

标签 统计

spring ×1

spring-boot ×1

spring-security ×1