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

前端 未结 8 791
慢半拍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:13

    Just my 2 Cents here ..

    Bootstrap.yml or Bootstrap.properties is used to fetch the config from Spring Cloud Server.

    For Example, in My Bootstrap.properties file I have the following Config

    spring.application.name=Calculation-service
    spring.cloud.config.uri=http://localhost:8888
    

    On starting the application , It tries to fetch the configuration for the service by connecting to http://localhost:8888 and looks at Calculation-service.properties present in Spring Cloud Config server

    You can validate the same from logs of Calcuation-Service when you start it up

    INFO 10988 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888

提交回复
热议问题