With Spring Boot 1.2+ (<2.0) all it takes is a single property in application.properties:
spring.data.rest.basePath=/api
For 2.x, use
server.servlet.context-path=/api
More Related Contents:
- Spring Boot Configure and Use Two DataSources
- Filter invoke twice when register as Spring bean
- Spring MVC @PathVariable getting truncated
- Add context path to Spring Boot application
- Spring Boot Adding Http Request Interceptors
- Spring Boot REST service exception handling
- Using GZIP compression with Spring Boot/MVC/JavaConfig with RESTful
- Spring MVC – How to return simple String as JSON in Rest Controller
- CORS allowed-origin restrictions aren’t causing the server to reject requests
- How to manage REST API versioning with spring?
- How does the Spring @ResponseBody annotation work?
- Http Post request with content type application/x-www-form-urlencoded not working in Spring
- Filter order in spring-boot
- No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
- Spring Boot and custom 404 error page
- HttpSecurity, WebSecurity and AuthenticationManagerBuilder
- Multipart File upload Spring Boot
- Spring MVC – @Valid on list of beans in REST service
- Expose all IDs when using Spring Data Rest
- Spring Boot Actuator without Spring Boot
- What is username and password when starting Spring Boot with Tomcat?
- Difference between Interceptor and Filter in Spring MVC
- Spring Security HTTP Basic for RESTFul and FormLogin (Cookies) for web – Annotations
- How to re-create database before each test in Spring?
- Trying to use Spring Boot REST to Read JSON String from POST
- Using @RequestParam for multipartfile is a right way?
- Spring REST security – Secure different URLs differently
- Trying to create REST-ful URLs with multiple dots in the “filename” part – Spring 3.0 MVC
- Programmatically restart Spring Boot application / Refresh Spring Context
- How I create an error handler (404, 500…) in Spring Boot/MVC