Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloWord': Unsatisfied dependency expressed through field 'testMapper': Error creating bean with name 'testMapperImpl': Unsatisfied dependency expressed through field 'testDao': No qualifying bean of type 'com.example.myspringboot.Dao.TestDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Description:
Field testDao in com.example.myspringboot.Service.TestMapperImpl required a bean of type 'com.example.myspringboot.Dao.TestDao' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.myspringboot.Dao.TestDao' in your configuration.
不要用这个注释:
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
只用:
@SpringBootApplication文章来源:https://www.toymoban.com/news/detail-553973.html
//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
//@MapperScan()
@SpringBootApplication
//@EnableScheduling
public class MySpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(MySpringBootApplication.class, args);
}
}
dao层无法注入service文章来源地址https://www.toymoban.com/news/detail-553973.html
到了这里,关于JAVA入门大坑:expected at least 1 bean which qualifies as autowire candidate. Dependency annotations的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!