What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

前端 未结 8 778
慢半拍i
慢半拍i 2020-12-02 03:13

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different.

8条回答
  •  离开以前
    2020-12-02 04:03

    Bootstrap.yml is used to fetch config from the server. It can be for a Spring cloud application or for others. Typically it looks like:

    spring:
      application:
        name: "app-name"
      cloud:
        config:
          uri: ${config.server:http://some-server-where-config-resides}
    

    When we start the application it tries to connect to the given server and read the configuration based on spring profile mentioned in run/debug configuration.

    If the server is unreachable application might even be unable to proceed further. However, if configurations matching the profile are present locally the server configs get overridden.

    Good approach:

    Maintain a separate profile for local and run the app using different profiles.

提交回复
热议问题