There are three ways to set context path in the spring boot application.
Scenario 1
If you are using a standalone Tomcat server instance, it doesn’t allow you to use the following property:
server.servlet.context
Refer to the below URL:
https://stackoverflow.com/a/43856300/1936319
Scenario 2
For detailed steps on how to deploy a spring boot war into the Tomcat server, check out this URL:
https://www.baeldung.com/spring-boot-war-tomcat-deploy
Scenario 3
If you are using the embedded Tomcat server, refer to the below link to set your server context path using server.servlet.context-path for spring boot 2:
https://www.baeldung.com/spring-boot-context-path
Are you still facing issues even after trying the above ways? Drop in a comment and we will look into it. Thanks for checking out this blog!!
One thought on “How to set context path in Spring Boot for Tomcat”
@abdel even I looking for the answer, what if we are deploying the war file in external tomcat how to set context path. pise Dec 22 ’18 at 18:17