"Springify Multiconfig"

"Configuration per module for Spring Boot projects"

License

License

Categories

Categories

config Application Layer Libs Configuration
GroupId

GroupId

com.it-surmann
ArtifactId

ArtifactId

springify-multiconfig
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

"Springify Multiconfig"
"Configuration per module for Spring Boot projects"
Project URL

Project URL

https://github.com/tleipzig/springify-multiconfig
Source Code Management

Source Code Management

https://github.com/tleipzig/springify-multiconfig

Download springify-multiconfig

How to add to project

<!-- https://jarcasting.com/artifacts/com.it-surmann/springify-multiconfig/ -->
<dependency>
    <groupId>com.it-surmann</groupId>
    <artifactId>springify-multiconfig</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.it-surmann/springify-multiconfig/
implementation 'com.it-surmann:springify-multiconfig:1.0.0'
// https://jarcasting.com/artifacts/com.it-surmann/springify-multiconfig/
implementation ("com.it-surmann:springify-multiconfig:1.0.0")
'com.it-surmann:springify-multiconfig:jar:1.0.0'
<dependency org="com.it-surmann" name="springify-multiconfig" rev="1.0.0">
  <artifact name="springify-multiconfig" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.it-surmann', module='springify-multiconfig', version='1.0.0')
)
libraryDependencies += "com.it-surmann" % "springify-multiconfig" % "1.0.0"
[com.it-surmann/springify-multiconfig "1.0.0"]

Dependencies

runtime (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar

Project Modules

There are no modules declared in this project.

Springify Multiconfig Build Status Maven Central Licence

Springify Multiconfig loads application YAML files from all jars in the classpath into the application context of a Spring Boot application, helping to split the configuration of multi-module projects.

It’s part of Springify, a set of open source libraries supporting the development of Spring Boot projects.

Usage

Just add the dependency from the Maven Central Repository:

<dependency>
  <groupId>com.it-surmann</groupId>
  <artifactId>springify-multiconfig</artifactId>
  <version>1.0.0</version>
</dependency>

Springify Multiconfig is now scanning for files with the name application-mc-*.yml, which are then loaded into the application context.

Example

A typical multi-module project may look like this.

 +-------------------+
 |    module-web     | containing application.yml, application-prod.yml
 +-------------------+
          |
          V
 +-------------------+
 |    module-blog    | containing application-mc-blog.yml
 +-------------------+
          |
          V
 +-------------------+
 | module-newsletter |  containing application-mc-newsletter.yml
 +-------------------+
          |
          V
 +-------------------+
 |   module-basics   | containing application-mc-basics.yml
 +-------------------+

The separation helps to keep code and configuration together, so each module can provide its own configuration if needed. The default behaviour for initializing the application context remains untouched, so in the example the application YAML files of module-web are loaded by Spring Boot itself (depending on the active profile).

Tip
Specify the dependency to springify-multiconfig on the lowest module (module-basics).

When the application is started, all modules are part of it and all application YAML files are loaded. They are ordered corresponding to the dependency graph, so in the example the application-mc-blog.yml would override properties of application-mc-newsletter.yml and application-mc-basics.yml with the same name (if present).

If a module contains a test class initializing the context, only the application YAML files of the current module plus dependencies are loaded. For example a class NewsletterServiceIT in module-newsletter annotated with @SpringBootTest would load application-mc-basics.yml as well as application-mc-newsletter.yml, but nothing else.

Versions

Version
1.0.0