springboot配置jsp

spring.mvc.view.prefix= /WEB-INF/jsp/
spring.mvc.view.suffix= .jsp

pom.xml

 <!--jsp支持-->
    <!-- servlet 依赖. -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
    </dependency>
    <!-- tomcat 的支持.-->
    <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>
      <scope>provided</scope>
    </dependency>
Application.java
@SpringBootApplication
@EnableCaching(proxyTargetClass = true) // 开启缓存功能
public class Application extends SpringBootServletInitializer implements CommandLineRunner {



    // Java EE应用服务器配置,
    // 如果要使用tomcat来加载jsp的话就必须继承SpringBootServletInitializer类并且重写其中configure方法
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

// 入口 public static void main(String[] args) { SpringApplication.run(Application.class, args); } }

 

posted @ 2018-03-21 10:21  程序猿001  阅读(335)  评论(0编辑  收藏  举报