Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; n

就是项目在启动时 会去查找所需要的bean 如果找不到或者找个多个就会报这个错 全局搜索一下看看是不是已经有了内置的类 然后你又创建了一样的

把你创建的多出来的bean删掉就可以了

@Primary 是你把它放在哪个类上面 项目启动查找bean时 会优先使用这个类

posted @ 2024-12-24 13:42  秃头少女and战战  阅读(685)  评论(0)    收藏  举报