修复 a bean of type xxx that could not be found 问题

当遇到'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' Bean无法找到的错误时,可能是因为使用了多个继承自WebSecurityConfigurerAdapter的类。解决办法是在WebMvcConfig类上设置@EnableWebSecurity。
摘要由CSDN通过智能技术生成

 

a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' that could not be found

    package com.mahmut.demoemployee.application.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;


@Configuration
public class WebMvcConfig extends WebSecurityConfigurerAdapter {

    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        return bCryptPasswordEncoder;
    }

}

 

You used multiple class which extends of <

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"A component required a bean of type that could not be found"这个错误通常是因为在应用程序的配置中找不到所需的bean类型引起的。根据提供的引用内容,有几种可能的解决方法。首先,你可以考虑在应用程序的配置文件中定义所需类型的bean。例如,在引用中,建议在配置中定义一个类型为'xxx.service.xxxService'的bean。同样,在引用中,建议在配置中定义一个类型为'xxx.config.xxxConfig'的bean。这样,应用程序就能找到所需的bean类型,解决了错误。另外,你还可以检查是否正确导入了相关的包,并确保类路径和包名与配置文件中的一致。如果问题仍然存在,可以尝试重新编译或重新构建项目,以确保所有的依赖项都正确配置。总之,解决"A component required a bean of type that could not be found"错误的方法是在配置文件中定义所需的bean类型,并确保相关的包和类路径正确配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [A Component required a bean of typexxx.config.xxx‘ that could not be found问题解决办法](https://blog.csdn.net/qq_39691492/article/details/118085232)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值