在官网(http://start.spring.io/)上generate project,将生成的项目导入idea中,运行之后控制台输出“Unregistering JMX-exposed beans on shutdown”,tomcat也没有运行。寻找原因,看了下pom.xml文件中tomcat依赖关系如下:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
将<scope>provided</scope>注释掉,重新运行项目便可启动嵌入的tomcat服务器:Tomcat started on port(s): 8080 (http)