在spring boot中将属性放在application.yml或bootstrap.yml上有什么区别? [英] What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?
问题描述
在spring boot中将属性放在application.yml或bootstrap.yml上有什么区别?
在logging.config情况下,应用程序的工作方式不同。
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.
推荐答案
我刚才问过 Spring Cloud
伙计们,我想我应该分享我在这里的信息。
I have just asked the Spring Cloud
guys and thought I should share the info I have here.
bootstrap.yml
在 application.yml
之前加载。
bootstrap.yml
is loaded before application.yml
.
它通常用于以下:
- 使用Spring Cloud Config Server时,应指定
spring.application.name
和spring.cloud.config.server.git.uri
里面bootstrap.yml
- 一些
加密/解密
信息
- when using Spring Cloud Config Server, you should specify
spring.application.name
andspring.cloud.config.server.git.uri
insidebootstrap.yml
- some
encryption/decryption
information
从技术上讲, bootstrap.yml
由父Spring ApplicationContext
加载。父 ApplicationContext
在使用 application.yml
之前加载。
Technically, bootstrap.yml
is loaded by a parent Spring ApplicationContext
. That parent ApplicationContext
is loaded before the one that uses application.yml
.
这篇关于在spring boot中将属性放在application.yml或bootstrap.yml上有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!