1. 程式人生 > >Spring Boot 打jar包 無法響應jsp 問題

Spring Boot 打jar包 無法響應jsp 問題

  1. <!--增加jsp依賴 -->

         <dependency>

            <groupId>org.apache.tomcat.embed</groupId>

            <artifactId>tomcat-embed-jasper</artifactId>

           <scope>provided</scope>

        </dependency>

     <dependency>

             <groupId>javax.servlet</groupId>

            <artifactId>jstl</artifactId>

    </dependency>

2.編譯外掛版本指定1.4.2

<plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <version>1.4.2.RELEASE</version>
</plugin>

3.<!-- 將src/main/webapp下的所有檔案檔案編譯到classes/META-INF/resources下-->

<resource>
   <directory>src/main/webapp</directory>
   <targetPath>META-INF/resources</targetPath>
   <includes>
      <include>**/*.*</include>
   </includes>
</resource>

    4.application 配置

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