springboot access jsp page 404

in conclusion

In previous versions of springboot1.4.2, the project will be packaged into a jar, add the corresponding dependent, 404 no problem, after 1.4.2, if the project will be packaged into a jar, always 404, because from 1.4.2 after, spring is not in support of the jar package in the form of access jsp page, if you want to solve, can only be changed to jar the form of war

Prior to 1.4.2, jar file is configured correctly

		#必须
		<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>
		<build>
		<finalName>xxx</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					#打包指明主类,不然会报错
					<mainClass>com.WithjoyApplication</mainClass>
				</configuration>
				#用1.4.1版本
				<version>1.4.1.RELEASE</version>
			</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>true</filtering>
			</resource>
		</resources>
	</build>

After 1.4.2, can only support jsp page with the form of the war package

Portal stackOverFlow
portal Koreans met 404 problem

Published 18 original articles · won praise 22 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_41023230/article/details/104508124