SpringBoot碰到的常见问题

这几天,用到springboot,但总是碰到许多bug,下面就让我来总结总结我碰到的bug。以免之后碰到这些bug不知道怎么解决。

第一个问题:

SpringBoot碰到的常见问题_第1张图片

这指的是:
配置用于监听端口8080的Tomcat连接器启动失败。端口可能已经在使用中,或者连接器可能配置错误。
(你需要的是关闭一个Tomcat进程)

第二个问题:

SpringBoot碰到的常见问题_第2张图片
指的是springboot项目没有运行成功。你需要去看看配置文件。你要去检查检查pom.xml里的代码。

第三个问题:

第一种情况:
SpringBoot碰到的常见问题_第3张图片
当你在浏览器中输入localhost:8080 后你发现什么也没出现。这是因为你在创建项目时,没有选择web
SpringBoot碰到的常见问题_第4张图片
第二种情况

SpringBoot碰到的常见问题_第5张图片
这是因为你没有在static中给它一个初始页面。因为static里面是空的,它找不到所需的页面,所以报404
SpringBoot碰到的常见问题_第6张图片

第四个问题:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-05-08 10:11:20.975 ERROR 11344 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

针对这个问题,我上网上搜的几种方法也没有什么效果,反而出现新的错误 。
后来再仔细排查的时候发现:
我的Controller包和Application包处于平行位置
实际上Controller包必须在Application包里才能被扫描到,从而正常运行程序,所以只要把Controller包移动到Application包内,错误就没有了
值得注意的是:
这个问题是有多种情况的。原因都是包没有找到的。我的问题是其中一种情况。各种问题要区别对待呀。

你可能感兴趣的:(SpringBoot)