How do I choose the URL for my Spring Boot webapp?
You need to set the property server.contextPath
to /myWebApp
.
Check out this part of the documentation
The easiest way to set that property would be in the properties file you are using (most likely application.properties
) but Spring Boot provides a whole lot of different way to set properties. Check out this part of the documentation
EDIT
As has been mentioned by @AbdullahKhan, as of Spring Boot 2.x the property has been deprecated and should be replaced with server.servlet.contextPath
as has been correctly mentioned in this answer.
As of spring boot 2 the server.contextPath
property is deprecated. Instead you should use server.servlet.contextPath
.
So in your application.properties file add:
server.servlet.contextPath=/myWebApp
For more details see: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#servlet-specific-server-properties