我正在将我的一个微服务迁移到Spring Boot2.0.0.M6,在命令行上使用--spring.config.location=选项时出现AND错误.错误如下:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'property' in value "${property}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:834) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1081) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1060) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:578) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:367) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE]
... 50 common frames omitted

如果我不使用自定义属性文件,则一切都按预期工作,或者使用发布版本.我使用以下命令启动应用程序:

java -jar application.jar --spring.config.location=app.properties

Update

I notice that when using this option Spring completely replaces the default application.properties from the project, unlike previous Spring versions which just overwrites the properties in the argument file. Is this a bug?

Update 2

全队得了response分,很明显这是故意的行为.现在try 了解是否有使用旧版本行为的方法.

推荐答案

As stated by the Spring team the correct way to use the old behavior from the spring.config.location is to use the new spring.config.additional-location

Kotlin相关问答推荐

创建具有共同父类型的两种不同类型对象的列表的最有效方法是什么?

Kotlin:有限的并行性并不是限制并行性

如何修改muableStateMapOf的值?

如何在不基于数据 map 的情况下将图例添加到lets plot kotlin

在 kotlin 中使具体化字段可选

Lets plot Kotlin中的多轴比例

Kotlin 数据类中的大量参数

如何为 Kotlin 中的每个循环设置以避免越界异常

如何在 Hibernate Panache 中进行部分搜索

在 Kotlin 中,::class.simpleName是做什么的?

如何在 Kotlin 中使用 volatile

DatabaseManager_Impl 不是抽象的,不会覆盖 RoomDatabase 中的抽象方法 clearAllTables()

如何在 Android Studio 3.1.3 中查看 Kotlin 中有趣的源代码?

Kotlin中的下划线名称是为什么保留的?

类型不匹配:推断类型为 LoginActivity 但应为 LifecycleOwner

如何在Android Studio 4.1中默认启用Kotlin Android扩展

如何将 CameraView 与 Jetpack Compose 一起使用?

Kotlin flatMap - map

如何在不绑定ViewModel(MVVM)中的UI的情况下使用android导航?

在 IntelliJ Idea 中未为 Kotlin @ConfigurationProperties 类生成 spring-configuration-metadata.json 文件