IntelliJ Idea Could not autowire. No beans of 'xxxx' type found的错误提示 和 eclipse 转idea
1.在Idea导入eclipse spring项目编译时会遇到 Could not autowire. No beans of 'xxxx' type found 的错误提示,但是程序是没错的,这是由于idea的spring 代码检测级别过高,可以设置低些。比如警告或者忽略。
2. spring boot项目在eclipse启动正常,idea启动失败,报错:org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean 经排查是idea pom配置原因
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
之前为了同时兼容jar和war部署scope写为provided,在idea无法识别web环境,故去掉<scope>provided</scope>后 正常