I want to change context path for spring boot 2 for example i want to serve on http://localhost:8080/test/
i mean it not working for me with spring-boot-starter-webflux:2.0.0.RELEASE
it only working with spring-boot-starter-web::2.0.0.RELEASE
I have tried
server.servlet.context-path=/test
But nothing happened to me still serve on url http://localhost:8080/
Just like many other configuration options, the context path in Spring Boot can be changed by setting a property, server. servlet. context-path. Note that this works for Spring Boot 2.
Simply put, the context path is a name with which a web application is accessed. It is the root of the application. By default, Spring Boot serves the content on the root context path (“/”).
1.1 Right click on the project, select Properties , Web Project Settings , update the context root here. 1.2 Remove your web app from the server and add it back. The context root should be updated. 1.3 If step 2 is failing, delete the server, create a new server and add back the web app.
In order to have multiple context paths, you're limited to deploying the application multiple times with that convenient property set to what you want for each deployment. However, this is resource expensive because you're spinning up two applications for every one application you would normally spin up.
If you use the servlet API then the property is now called
server.servlet.context-path=/myapp
As confirmed by Andy Wilkinson @andy-wilkinson of the Spring Boot team via Gitter
There’s no concept of context path in WebFlux so there’s no equivalent property
i.e WebFlux doesn't support context path configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With