@Laplie Andersonがここで提案したのはSpring Environment backed by Typesafe Configであるが、スプリングブートアプリケーションでは何をしようとしている。spring-bootタイプセーフな設定に裏打ちされた環境
私は、さまざまなスプリングアクティブプロファイルに異なる設定ファイルをロードしたいと思います。ここに例があります。
@Configuration()
@Import(value = {CommonConfiguration.class})
@PropertySource(factory=TypesafePropertySourceFactory.class, value="config/dev/app.conf")
@Profile("dev")
public class DevConfig {}
@Configuration()
@Import(value = {CommonConfiguration.class})
@PropertySource(factory=TypesafePropertySourceFactory.class, value="config/prod/app.conf")
@Profile("prod")
public class ProdConfig {}
しかし、これはアプリの起動時に次のエラーになり
..java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration.buildProperties
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
...
Caused by: com.typesafe.config.ConfigException$BadPath: path parameter: Invalid path 'spring.info.build.location:classpath:META-INF/build-info.properties': Token not allowed in path expression: ':' (you can double-quote this token if you really want it here)
at com.typesafe.config.impl.PathParser.parsePathExpression(PathParser.java:155) ~[config-1.3.1.jar!/:na]
at com.typesafe.config.impl.PathParser.parsePathExpression(PathParser.java:74) ~[config-1.3.1.jar!/:na]
...
私は何をしないのですか?
これを行うにはより良い方法がありますか?
次のバージョンはここに遊びに..です
春ブート:1.5.6.RELEASE
タイプセーフの設定:1.3.1
私も同じ問題に直面していますが、起動時にHOCON設定を使用することができましたか? – Ysak
他のコメントで述べたようにHOCONの代わりに.ymlファイルを使用しました。 – Gagan