SpringBoot项目打包成war包 访问路径不用加项目名
SpringBoot项目打包成war包 访问路径不用加项目名
需求:把springboot打包成war包,在打包后,我们把这个war包放到tomcat的webapps下。但是在启动tomcat后,需要加上项目名才能访问,不然会出现404错误,解决如下:
- 进入 tomcat - conf - server.xml
- 添加Context配置:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<!--added here -->
<Context path="" docBase="你的项目名" reloadable="true"/>
</Host>
- 但是感觉不是一个长久的方法,希望有更好的解决方案。

浙公网安备 33010602011771号