yaml中的两个配置文件-当使用第一个配置文件,而第二个配置文件具有空值时,出现错误

时间:2019-01-09 10:04:10

标签: java spring spring-boot yaml

我正在使用.yaml文件进行配置。我的程序使用两个配置文件之一。我希望第二个配置文件的配置从一开始就为空,并且仅在用户选择使用第二个配置文件时由用户填充。否则,在使用第一个配置文件时,“第二个”配置应为空值。
但是,当我将“ first”设置为活动状态时,仍然会收到错误消息,指出“ second”配置中没有任何值:Error: Expected $.length = 0 to equal 1.

我尝试制作单独的文件,例如'application-first'和'application-second',但是没有成功。
任何想法,什么可以帮助我实现使用“第一”配置文件时能够具有空的“第二”配置的目标?

./ yaml文件:

Error creating bean with name 'defaultConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'someVariableUsedBySecondProfile' in value "${someVariableUsedBySecondProfile}"

0 个答案:

没有答案