Skip to content

Add Global API Prefix For Rest API in Spring Boot

For a service application, a global API prefix is required.

For example, we want that all the api have a prefix such as api, and we can achieve this by adding the following configuration in application.properties.

Properties
server.servlet.context-path=/api
Now, all rest API will have the prefix api.