Tim Wheeler
Tim Wheeler

Reputation: 75

Override Context Path in Spring Boot / Tomcat

In Spring Boot / Tomcat is it possible to override the context-path (server.servlet.context-path=/api) specified in my application.properties for a single @RequestMapping?

My current context path is /api for the core application, but I have a public-facing portion of the API that I'd like to expose as /id and not /api/id.

Upvotes: 1

Views: 733

Answers (1)

Rajesh
Rajesh

Reputation: 732

With Spring Boot 2.x, all it takes is a single property in application.properties:

server.servlet.context-path=/api

With Spring Boot 1.2+ (<2.0)

spring.data.rest.basePath=/api

ref link : https://docs.spring.io/spring-data/rest/docs/current/reference/html/#getting-started.changing-base-uri

Upvotes: 0

Related Questions