eclipse中的SSH项目中,本地测试请求路径一般为http://localhost/ProjectName,打包之后放到服务器上时,访问路径为:http://xxx.com/ProjectName,这里的ProjectName一般为打包之后的war文件名称。

在SpringBoot项目中,本地测试请求路径为:http://localhost/ProjectName,打包成war文件放到服务器上时,请求路径为http://localhost/ProjectName出错404,找不到资源,原因是SpringBoot的默认请求根路径为:war包所在路径+项目名,而ssh项目的根路径为:war包所在路径,所以在访问SpringBoot项目是必须加上tomcat解压后的war包生成的文件夹名,然后再是项目名,这样才能访问到。

【SpringBoot】SpringBoot中请求路径问题_war包