0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SpringBoot2.3.0以降で@PropertySourceのvalueに使用しているプレースホルダの解決に失敗する

Posted at

内容

タイトルそのままです。
SpringBoot2.3.0 以降で@PropertySource の value の指定に classpath:/something-config-${spring.profiles.active}.yml のようにプレースホルダを使っていると、解決できずに例外が発生する。
現在の Boot の最新バージョンは 2.3.1 です。

ソース

SomethingConfig.java
@Configuration
@ConfigurationProperties(prefix = "something")
@Component
@PropertySource(value = {"classpath:/something-config.yml","classpath:/something-config-${spring.profiles.active}.yml"}, factory = YamlPropertySourceFactory.class)
@Data
public class SomethingConfig {

    private String setting1;
    private String setting2;
}

結果

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:/somethign-config-${spring.profiles.active}.yml"

解決方法

とりあえず 2.2 系を使いました。

issue

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?