Reputation: 14363
I have this in my application.yml
spring: data: rest: base-path: /api
But it keep getting ignored by my configuration and it start the repository in /
Is there any way to configure it in java code or differently ?
I have found this but it's a bit deprecated :
http://pavelmakhov.com/2016/02/spring-data-rest-change-base-path
Upvotes: 1
Views: 419
Reputation: 11017
@Configuration
class CustomRestMvcConfiguration {
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {
return new RepositoryRestConfigurerAdapter() {
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
configuration.setBasePath("/api")
}
};
}
}
http://docs.spring.io/spring-data/rest/docs/current/reference/html/#_changing_the_base_uri
Upvotes: 1