Spring boot configuration multi modules

时间:2015-06-30 13:50:48

标签: spring-boot module

According to some other posts, it looks only one application.properties in the top-level aggregator project should be defined.

Then, in other modules, a specific file by module for related properties handled using @PropertyResource.

It looks wildcard on property resources are not supported or not handled when using spring boot?!

Let's imagine we develop an engine application:

Modules: engine-core, engine-communication, engine-launcher (module containing the spring boot application).

In the engine launcher module, I would like to define a configuration like this:

@Configuration @PropertySource(value = "classpath*:/config/engine-*-config.properties", ignoreResourceNotFound = true) public class EngineConfiguration { ... }

With related configuration files in the modules. When doing this, it looks these configuration files cannot be found.

What's the best way to have a modular/flexible configuration. Any ideas?

1 个答案:

答案 0 :(得分:0)

看起来@PropertySource不支持资源位置的通配符,如以下帖子中所述:classpath wildcard in @PropertySource