在spring boot中将属性放在application.yml或bootstrap.yml上有什么区别? [英] What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

查看:1348
本文介绍了在spring boot中将属性放在application.yml或bootstrap.yml上有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 and spring.cloud.config.server.git.uri inside bootstrap.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆