
然后编译出错:Unregistering JMX-exposed beans on shutdown
解决方法:
一、将pom文件中添加如下依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
另,如果不行,尝试再将下面依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
改为
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
重新运行项目。
如果还是报同样的错误,试试第二种方法:
二、有插件没有下载完成
查到插件的位置,看相应的jar包是否没有下载完成
如果没下载完成,上maven官网下载jar包,并放到相应的位置,或直接导入到工程
http://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core
这时,可以运行项目了。
当却出现另外的错误:
网页出现:This application has no explicit mapping for /error, so you are seeing this as a fallback.
原因1:
项目里还没有创建controller类,这里创建个HelloController.java类

原因2:
Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包
原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.
原因3:
在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题:
当pom文件下的spring-boot-starter-paren版本高时使用:
spring.mvc.view.prefix/spring.mvc.view.suffix
当pom文件下的spring-boot-starter-paren版本低时使用:
spring.view.prefix/spring.view.suffix
原因4:
控制器的URL路径书写问题
@RequestMapping(“xxxxxxxxxxxxxx”)
实际访问的路径与”xxx”不符合.
现在项目终于可以跑起来了。