springboot 发布jar中使用jsp做页面

pom文件中:

 <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.4.2.RELEASE</version>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/webapp</directory>
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>

据说需使用版本1.4.2.RELEASE,其他版本的发布后jsp无法访问,没做尝试
src/main/webapp
META-INF/resources
打包时会将webapp中的内容复制到jar包的META-INF/resources中,我项目中的jsp文件就在webapp/WEB-INF/jsp/中
application.yml中jsp的相关配置:

spring:
  mvc:
    view:
      prefix: /WEB-INF/jsp/
      suffix: .jsp
    throw-exception-if-no-handler-found: true
    static-path-pattern: /static/**
  resources:
    static-locations: classpath:/static/

pom中关于jsp的依赖项不一一列出

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页