想请教老师run code时候出现了securitycofig需要一个bean type的问题?

来源:16-3 -后台实现

慕的地8056960

2020-08-04

Field userDetailsService in com.example.initializerstart.config.SecurityConfig required a bean of type ‘org.springframework.security.core.userdetails.UserDetailsService’ that could not be found.

然后我尝试增加一个userserviceimplement,然而并还是依然有这个报错,想请教下老师这个问题应该如何解决呢?

然后看上面parent problem的补充说明写的是:
[ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘securityConfig’: Unsatisfied dependency expressed through field ‘userDetailsService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.springframework.security.core.userdetails.UserDetailsService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

写回答

1回答

老卫

2020-08-10

版本问题吧。
看我手记,改成与课程一致。

0
3
老卫
回复
慕的地8056960
跟课程配置保持一致即可。 这个是源码,参考 build.gradle 文件 https://git.imooc.com/coding-125/coding-125
2020-09-02
共3条回复

基于Spring Boot技术栈博客系统企业级前后端实战

毕设 Elasticsearch搜索+Thymeleaf模板+JPA+Security+BootStrap

1296 学习 · 738 问题

查看课程