In Spring Boot, an application property can be defined in application.properties file. For example, a prefix of Rest can be defined as
spring.data.rest.basePath=api
For JHipster which is based on Spring Boot, I guess that an application property could defined in the application.yml file. But none of the follow approach work for me: a 404 error.
spring.data.rest.basePath: api
spring:
data:
rest:
basePath: api
The other possibility is the configuration itself doesn't work.
I have same problem and finally figured it out!
Quote from Jhipster website:
In my case, I have set the properties in applicaiton-prod.yml
In ApplicationProperties class:
Then I use it as:
For instance use
max-wait
andhost
:Hope it helps.
The
application.yml
should be whit spaces not tabs.Try like this:
In my application the file is in the path:
After trying dozens of time how to handle the problem I finally figured out how to make it work. Maybe it will be useful for somebody.
To use prefix for controllers (let's say for example
jh
) we need to useserver.servlet.context-path
and notspring.data.rest.basePath
.Link to documentation https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
So
application.yml
should looks like this: