diff --git a/CHANGELOG.md b/CHANGELOG.md index 38cbc6d3..999e4f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,26 @@ planned; the next minor with new canonical DSL primitives is calls through SLF4J. Previously the bridge was provided transitively via `flexmark-all`; making it explicit keeps the classpath reproducible after the flexmark narrowing above. +- Marked `jackson-dataformat-yaml` as `true`, + mirroring the existing `poi-ooxml` pattern. The only consumer is + `ConfigLoader.loadConfigWithEnv(...)` when the caller passes a + `.yaml` / `.yml` resource; library consumers that load JSON + configs (or skip `ConfigLoader` altogether) no longer pull in the + ~1.7 MB SnakeYAML transitive footprint. Applications that load + YAML configs through this helper must now declare + `jackson-dataformat-yaml` in their own build. +- Removed the unused `jackson-module-jsonSchema` dependency — no + code path references it. +- Removed the explicit `snakeyaml` dependency declaration and the + `snakeyaml.version` property. SnakeYAML is now resolved + transitively (and `optional`) through `jackson-dataformat-yaml`, + which version-aligns it with Jackson's BOM. + +### Documentation + +- `ConfigLoader.loadConfigWithEnv` Javadoc now states the YAML + path requires `jackson-dataformat-yaml` on the classpath and + throws `NoClassDefFoundError` when the optional dep is absent. ### Internal diff --git a/pom.xml b/pom.xml index db3ea72c..455f2e58 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,6 @@ 5.5.1 21.0.2 2.0.18 - 2.6 3.5.4 @@ -204,20 +203,22 @@ jackson-databind + com.fasterxml.jackson.dataformat jackson-dataformat-yaml - - - - com.fasterxml.jackson.module - jackson-module-jsonSchema - - - - org.yaml - snakeyaml - ${snakeyaml.version} + true diff --git a/src/main/java/com/demcha/compose/ConfigLoader.java b/src/main/java/com/demcha/compose/ConfigLoader.java index 93e2bb18..c40475ab 100644 --- a/src/main/java/com/demcha/compose/ConfigLoader.java +++ b/src/main/java/com/demcha/compose/ConfigLoader.java @@ -21,9 +21,21 @@ private ConfigLoader() { } /** - * Load YAML from classpath resource into the given class. + * Load YAML or JSON from a classpath resource into the given class. * Supports running from IDE and from a fat JAR. - * Optionally resolves ${ENV} or ${ENV:default} placeholders from environment variables. + * Optionally resolves {@code ${ENV}} or {@code ${ENV:default}} placeholders + * from environment variables. + * + *

Optional dependency: the YAML path requires + * {@code com.fasterxml.jackson.dataformat:jackson-dataformat-yaml} on + * the classpath. GraphCompose declares it as an optional Maven + * dependency since {@code v1.6.7}; applications that load YAML + * configs through this helper must add the artifact to their own + * build. JSON configs work without it. + * + * @throws java.lang.NoClassDefFoundError if {@code fileName} ends with + * {@code .yaml} / {@code .yml} and + * {@code jackson-dataformat-yaml} is not on the classpath. */ public static T loadConfigWithEnv(String fileName, Class clazz, boolean resolveEnv) { log.info("Initializing variables from '{}'", fileName);