springboot的優點之一:嵌入式servlet容器,缺點就是不支持JSPspring
若是要使用JSP模板,好比要引入外置servlet,須要如下幾個步驟:apache
1)把pom.xml配置文件設置packing爲tomcat
<packaging>war</packaging>
2)在pom.xml配置文件引入外置tomcatspringboot
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency>
3)在application.yml設置spring.mvc.view的屬性值,設置JSP對應的目錄以及後綴mvc
spring: mvc: view: prefix: /WEB-INF/jsp/ suffix: .jsp