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

I tried to deploy my site using many configurations to change it from a deployed military name. Is there any way to do this easily. Deployment will be for a cat sitting somewhere else. e.g. bitnami instance

I tried various combinations of settings in application.properties, but no one makes any difference:

 server.servlet.context-path=/a
    server.servlet.path=/b
    spring.webservices.path=/c
    server.contextPath=/m

The war is called demo-0.0.01-SNAPSHOT.war, and when it falls in the webapps directory, it creates the same directory and the site has the path / demo -0.0.01-SNAPSHOT. I thought with the days of Spring Boot it would be easy now, but a fool like me hasn't worked yet. Or do people just deploy the built-in versions with tomcats and run them now?

(BTW I also tried root.xml, no luck ... if I didnโ€™t do it wrong in a Windows window, first test on my dev block, linux for deployment)

Any help would be appreciated.

thank

+4
source share
2 answers

Spring Boot property to specify the path to the application context: server.contextPath.
But the fact that you are deploying your WAR in a standalone instance of Tomcat does not allow it.
In this configuration, you cannot use server.contextPathother properties specific to the container (for example, server.port). They are designed to work with an embedded instance of Tomcat.

Tomcat , Spring Boot. Tomcat (server.xml ROOT.xml ).

+2

finalName pom.xml maven . .

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

myapp.war. tomcat .

+2

Source: https://habr.com/ru/post/1676681/


All Articles