Changing the context path of deployed (Spring Boot) war on a container tomcat server. So it is not demo-0.01-SNAPSHOT Changing the context path of deployed (Spring Boot) war on a container tomcat server. So it is not demo-0.01-SNAPSHOT spring spring

Changing the context path of deployed (Spring Boot) war on a container tomcat server. So it is not demo-0.01-SNAPSHOT


The Spring Boot property to specify the context path of the application is : server.contextPath.
But the fact that you are deploying your WAR into a standalone Tomcat instance doesn't allow to use it.
In this configuration, you cannot use server.contextPath and other properties specific to the container (as for example server.port).These are designed to work with the embedded Tomcat instance.

The standalone Tomcat instance keeps indeed the control on these facilities provided by Spring Boot.So you have to configure it from the configuration file of the standalone Tomcat (server.xml or ROOT.xml way generally).


Adding finalName setting to pom.xml for maven will make the packaged war filename to it. For example.

<build>...<finalName>myapp</finalName></build>

The packaged filename will be myapp.war . When you deploy to tomcat it will set the context to the filename.