Adds support for YAML (YAML Ain't Markup Language) in your Java CDI and DeltaSpike application. Registers a configuration source to the DeltaSpike configuration mechanism to turn your YAML configurations to CDI aware properties.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Seth Falco e6d7765c99 Merge branch 'chores' into 'main'
chores: java 17, gradle 7, docs, namespace change, etc

See merge request SethFalco/yaml4deltaspike!3
2025-04-24 10:30:45 +00:00
config/checkstyle chore: add and apply checkstyle and amend copyright notices 2025-04-24 11:28:55 +01:00
gradle/wrapper chore: set gradle version to 7.6.4 2025-04-24 11:21:19 +01:00
src chore: add and apply checkstyle and amend copyright notices 2025-04-24 11:28:55 +01:00
.editorconfig chore: simplify editorconfig 2025-04-24 11:20:52 +01:00
.gitignore chore: add and apply checkstyle and amend copyright notices 2025-04-24 11:28:55 +01:00
.gitlab-ci.yml chore: set gradle version to 7.6.4 2025-04-24 11:21:19 +01:00
build.gradle chore: add and apply checkstyle and amend copyright notices 2025-04-24 11:28:55 +01:00
gradlew chore: set gradle version to 7.6.4 2025-04-24 11:21:19 +01:00
gradlew.bat chore: set gradle version to 7.6.4 2025-04-24 11:21:19 +01:00
LICENSE Initial Commit - Mostly implemented, one test case failing 2020-05-20 05:00:08 +02:00
NOTICE chore: add and apply checkstyle and amend copyright notices 2025-04-24 11:28:55 +01:00
README.md docs: revise readme 2025-04-24 11:25:39 +01:00
settings.gradle Initial Commit - Mostly implemented, one test case failing 2020-05-20 05:00:08 +02:00

YAML4DeltaSpike

Deprecation Notice

This project is no longer maintained, as I'm working on migrating YAML support upstream into DeltaSpike.

About

Provides YAML configuration support for the DeltaSpike configuration mechanism, and uses snakeyaml to bind the properties to an implementation of the MapConfigSource.

Getting Started

Import

Visit YAML4DeltaSpike on Maven Central, and follow the instructions for your build system of choice to add YAML4DeltaSpike to your project.

Usage

The configuration should work out of the box once you've added the dependency to your project.

YAML4Deltaspike automatically looks for an application.yml in the root of the classpath and loads it without any additional configuration.

If you want a custom file name, or load order, you can extend and override the YamlConfigSource class, and follow the instructions on the DeltaSpike documentation:

public class CustomYamlConfigSource extends YamlConfigSource {

    public CustomYamlConfigSource() {
        super("custom_application.yml", false);
    }
}

Examples

There are two modes for the YamlConfigSource, non-indexed (default) and indexed.

application:
  name: YAML4DeltaSpike
  messages:
    - source: source0
      target: target0
    - source: source1
      target: target1

Non-Indexed (Default)

Non-indexed mode will convert arrays of nested objects to a series of lists.

application.name=YAML4DeltaSpike
application.messages.source=source0,source1
application.messages.target=target0,target1

Indexed

Indexed mode will convert arrays of nested objects to the property key, but with a 0-indexed suffix, similarly to that of an array-access in Java.

application.name=YAML4DeltaSpike
application.messages[0].source=source0
application.messages[0].target=target0
application.messages[1].source=source1
application.messages[1].target=target1