今天第一次啟動一個springboot項目
遇到這個問題是pom.xml文件中的有一個配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
這里provided這種配置默認這個依賴是智能在編譯和測試時用的,所以把它改成compile或者直接刪除,因為compile是默認的
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
這樣在運行就正常了