[英]In spring-cloud project, is it ok to replace application.yml with bootstrap.yml totally?
In spring-cloud
projects, for some reason, need to put some properties into bootstrap.yml
, so that to make the specific properties available earlier.在
spring-cloud
项目中,出于某种原因,需要将一些属性放入bootstrap.yml
中,以便更早地使特定属性可用。
Then there are 2 config files: bootstrap.yml
and application.yml
.然后有 2 个配置文件:
bootstrap.yml
和application.yml
。
Wondering is it ok to put everying into bootstrap.yml
, and remove application.yml
totally, to make it cleaner.想知道是否可以将所有内容放入
bootstrap.yml
并完全删除application.yml
以使其更清洁。
Since bootstramp.yml
is just loaded earlier, it seems to be ok, right?由于
bootstramp.yml
只是之前加载的,所以似乎没问题,对吧? Or, will this cause some issue in some case?或者,这会在某些情况下引起一些问题吗?
Basically idea is to get configurations from ConfigServer using Spring Cloud Config.基本上想法是使用 Spring Cloud Config 从ConfigServer获取配置。 But sometimes we need some configurations eg spring.application.name upfront so, I'm using those configurations in
bootstrap.yml
.但有时我们需要一些配置,例如spring.application.name ,所以我在
bootstrap.yml
中使用这些配置。 Which generally overrides what's in an application.yml [if present]).这通常会覆盖 application.yml [如果存在] 中的内容)。 Reference
参考
Plus, yes you can put all your configurations in bootstrap.yml
and it works simply fine.另外,是的,您可以将所有配置放在
bootstrap.yml
中,它工作得很好。 I've tested with more than four microservices.我已经测试了超过四个微服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.