Where and How To Define An Application Property? - JHIpster

后端 未结 3 776
终归单人心
终归单人心 2021-01-19 01:41

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.baseP         


        
3条回答
  •  醉梦人生
    2021-01-19 01:52

    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 use server.servlet.context-path and not spring.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:

    server:
        servlet:
            context-path: /jh
            session:
                cookie:
                    http-only: true
    

提交回复
热议问题