国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Spring打包jar包時jsp頁面無法訪問問題解決

瀏覽:122日期:2023-09-05 16:37:15

spring打包jar包時jsp頁面無法訪問

問題如下

Spring打包jar包時jsp頁面無法訪問問題解決

當前pom.xml配置

<build> <resources> <!--引入配置文件--> <resource><directory>src/main/resources</directory><filtering>false</filtering> </resource> <!--引入靜態文件--> <resource><directory>src/main/webapp</directory><targetPath>META-INF/resources</targetPath><filtering>false</filtering> </resource> </resources> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build>

解決辦法:

1.高版本的插件不支持jsp,給spring-boot-maven-plugin指定版本號“1.4.2.RELEASE”

<build> <resources> <!--引入配置文件--> <resource><directory>src/main/resources</directory><filtering>false</filtering> </resource> <!--引入靜態文件--> <resource><directory>src/main/webapp</directory><targetPath>META-INF/resources</targetPath><filtering>false</filtering> </resource> </resources> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>1.4.2.RELEASE</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build>

2.根據spring官網說明,可打包war包,仍然可使用jar -jar xxx.war執行。

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-limitations

JSP LimitationsWhen running a Spring Boot application that uses an embedded servlet container (and is packaged as an executable archive), there are some limitations in the JSP support.With Jetty and Tomcat, it should work if you use war packaging. An executable war will work when launched with java -jar, and will also be deployable to any standard container. JSPs are not supported when using an executable jar.Undertow does not support JSPs.Creating a custom error.jsp page does not override the default view for error handling. Custom error pages should be used instead.

<packaging>war</packaging>

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-documentation

spring官方不推薦使用jsp,推薦使用thymeleaf、freemaker、velocity等其他模塊引擎。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 国产特黄一级一片免费 | 精品一区二区三区视频在线观看 | 美女黄频免费观看 | 亚洲国产精品一区二区三区久久 | 国产人成午夜免费噼啪视频 | 狠狠色狠狠综合久久 | www射射一区| 性色tv视频观看 | 国产高清在线精品一区a | 国产高清在线精品 | 国产日本在线视频 | 亚洲gogo人体大胆西西安徽 | 99久久国语露脸精品对白 | 一本一道久久综合狠狠老 | 99久久伊人一区二区yy5o99 | 国产精品麻豆一区二区三区v视界 | 国产真实自拍 | 成年美女黄网站色视频大全免费 | 欧美一级毛片无遮挡 | 国产精品激情丝袜美女 | 亚洲一区欧洲一区 | 国产高清精品久久久久久久 | 在线国产三级 | 中日韩精品视频在线观看 | 性精品| 欧美成免费 | 久草精品免费 | 国产精品短视频免费观看 | 一区二区三区伦理 | 久久国产a | 亚洲日本高清成人aⅴ片 | 欧美在线观看免费一区视频 | 九九久久国产精品 | 亚洲精品国产成人99久久 | 成人高清 | 国产综合在线观看 | 日本成人免费在线视频 | 亚洲成a v人片在线看片 | 成人一级大片 | 亚洲天堂资源网 | 亚洲精品免费观看 |