[Spring Boot] Set Context path for application in application.properties
If you were using Microservice with Spring Boot to build different REST API endpoints, context path might help you.
For example, you have two endpoints, each in a Microservice application:
1. team
2. players
They both have sub-route such as:
- [GET] info
- [POST] new
For each application you can set up:
team/application.properties:
# all the requests should be prefixed with /team
server.servlet.context-path=/team
players/application.properties:
# all the requests should be prefixed with /team
server.servlet.context-path=/players
Now when you access those endpoints, you should add prefix:
localhost:8080/team/info