做项目时,由于要使用nacos, 就升级了springboot版本。 但是万万没想到, 升级后jsp不显示了。
从1.3 升级到 1.5。 也并非什么大版本升级啊。 就很难受。
查了一圈文档有以下几个方案可用:
1. 打包方式由 jar 变为 war
这里有详细介绍。我就不多说了。 尝试了下确实可行。
官方关于此段落的限制说明:
Spring Boot Reference Guide
2. maven编译版本过高导致。
官方关于此段说明
Do not use the src/main/webapp directory if your application will be packaged as a jar. Although this directory is a common standard, it will only work with war packaging and it will be silently ignored by most build tools if you generate a jar.
由于一般没有指定版本,喔手动指定了一个版本。也可行
我是用面配置也可以编译后访问。 我的springboot 版本: 1.5.12
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
</plugin>