kingbbode / spring-boot-custom-yaml-importer

spring boot support for automatically loading custom yaml file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-boot-custom-yaml-importer

Build Status Coverage Status

spring boot support for automatically loading custom yaml file.

Spring Boot Compatibility

Version Spring Boot Version
0.3.0 2.4.x ~
0.2.0 2.2.x, 2.3.x
0.1.0 2.0.x, 2.1.x

Spring Boot offers three ways to load custom settings.

  • spring.config.location, spring.config.name
  • SpringApplicationBuilder
  • EnvironmentPostProcessor

[Spring Docs : howto-properties-and-configuration]

There is also this method using Profile

[main module]

spring:
  profiles:
    include:
      - a
      - b
      - c

[sub module a] application-a.yml

[sub module b] application-b.yml

[sub module c] application-c.yml

[Spring Docs : boot-features-external-config]

but this is cumbersome. when a lot of multi-modules and settings are created, you have to work on them every time.

so i made spring-boot-custom-yaml-importer

so that you can load the settings just by having dependencies.

Install

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compile 'com.github.kingbbode:spring-boot-custom-yaml-importer:0.3.0'
}

Usage

load the yaml file that is matched with resources/config/custom-*.yml.

write the settings you need for each of your modules here.

Single Module

|_src
|  |_main
|     |_resources
|           |_config
|           |    |_ custom-a.yml
|           |    |_ custom-b.yml
|           |    |_ custom-c.yml
|           |
|           |_application.yml  

Multi Module

|_app
|  |_src
|     |_main
|        |_resources
|              |_config
|              |   |_custom-a.yml
|              |
|              |_application.yml
|                   
|_module-b
|   |_src
|      |_main
|         |_resources
|               |_config
|                    |_custom-b.yml
|_module-c
|   |_src
|      |_main
|         |_resources
|               |_config
|                    |_custom-c.yml

About

spring boot support for automatically loading custom yaml file.


Languages

Language:Java 100.0%