Externalising Spring Boot properties when deploying to Docker

前端 未结 6 1948
天命终不由人
天命终不由人 2020-12-01 04:20

In my Spring Boot app I want to externalise the properties to run in a Docker container. When first deployed, the properties that are currently in my-server/src/main/

6条回答
  •  眼角桃花
    2020-12-01 04:45

    Personally I'd use Spring Cloud Config Server instead of trying to set up properties files all over the place.

    tl;dr it allows you to hold properties in git (which allows version control, branching etc) at a per environment/profile level in a centralised location, which are then served up by REST. Spring Boot has full support for it; in effect it's just another property source that ends up in your Environment.

    https://spring.io/guides/gs/centralized-configuration/

提交回复
热议问题