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文章來源:http://www.zghlxwxcb.cn/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文章來源地址http://www.zghlxwxcb.cn/news/detail-553973.html
到了這里,關(guān)于JAVA入門大坑:expected at least 1 bean which qualifies as autowire candidate. Dependency annotations的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!