我是写了一个webSocket使用的jsp页面,相当于Springboot2.0整合jsp。本地运行没事。但打成jar包,java -jar后发现页面显示找不到资源。我的属于springboot版本问题,解决方法如:2.
Springboot不建议使用JSP,所以会忽略JSP文件。
1.打包成jar的过程中,没有包含jsp文件。
可在pom.xml的-下加入下面代码。
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
2.Springboot版本问题。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--版本改为1.4.2-->
<version>1.4.2.RELEASE</version>
</plugin>