1、ERROR o.s.boot.SpringApplication - Application startup failed
控制台错误信息拉到最下面,找到It was loaded from the following location:这一行,冒号后的内容就是需要删除的文件(一般都是因为jar包重复),删除文件后重新运行,spring’boot项目成功启动。
2、启动Tomcat之后,发现localhost正常访问,但localhost:8080无法进入,切入文件夹点击Tomcat8.exe文件闪退。
Cd到tomcat的bin目录下,输入 service.bat install ,切回文件夹重现点击exe文件,正常启动,浏览器测试localhost:8080端口可用。
3、@RestController无效
Pom.xml文件里添加相应依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
4、warn:spring.jpa.open-in-view is enabled by default
application.properties文件配里添加spring.jpa.open-in-view is enabled by default。
5、intellij idea Entity类报错“Cannot resolve table”
Persistence选择项目,右键。选择Assign Data Source,DataSource选择需要连接的数据库。
6、inspects a maven model for resolution problems
找到pom.xml,右击选择mavendownload source and documention
7、注意Maven仓库配置一致的问题
8、Could not autowire. No beans of ‘xxxx’ type found
编译运行无错,但会报红色错误。降低Autowired检测的级别,将Severity的级别由之前的error改成warning或其它可以忽略的级别。(Settings-inspections-spring-spring core-code-autowiring for Bean Class)
9、ORA-00942: 表或视图不存在
解决方法:
- 检查JDBC数据源是否配置正确;
- 检查表或视图名称是否写错;
- 检查Java中数据源的数据库用户是否具有引用该表或视图的权限。(首先确认权限!大坑!)
10、Modifier ‘public’ is redundant for interface methods
接口的方法默认是 public abstract,直接删除Public即可。