Sourajit Basak
Sourajit Basak

Reputation: 693

Tomcat not using context path specified in Spring boot application

We are using spring boot for our web application. The context root is defined in WEB-INF/classes/common.properties as follows.

server.contextPath=<>

However after deployment the above value is not read and Tomcat is registering the name of the war as the context root.

Spring boot version = 1.5.2 Tomcat version = 8.0.53

Upvotes: 0

Views: 1800

Answers (1)

Do Trung Duc
Do Trung Duc

Reputation: 406

As I know, server.contextPath = not work for war file, it only work you deploy your application with jar file and Tomcat embedded.

If you want deploy your application with Tomcat and War file. You should add finalName setting to pom.xml. Example:

<build>
    ...
    <finalName>context path</finalName>
</build>

Upvotes: 1

Related Questions