Skip to content

Commit 40543e0

Browse files
committed
Polish SnakeYAML 2.0 upgrade
See gh-30048
1 parent 097758b commit 40543e0

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* Note that the value of "foo" in the first document is not simply replaced
6565
* with the value in the second, but its nested values are merged.
6666
*
67-
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6.
67+
* <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
6868
*
6969
* @author Dave Syer
7070
* @author Juergen Hoeller

spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.yaml.snakeyaml.DumperOptions;
3434
import org.yaml.snakeyaml.LoaderOptions;
3535
import org.yaml.snakeyaml.Yaml;
36+
import org.yaml.snakeyaml.composer.ComposerException;
3637
import org.yaml.snakeyaml.constructor.Constructor;
3738
import org.yaml.snakeyaml.inspector.TagInspector;
3839
import org.yaml.snakeyaml.nodes.Tag;
@@ -49,7 +50,7 @@
4950
/**
5051
* Base class for YAML factories.
5152
*
52-
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6.
53+
* <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
5354
*
5455
* @author Dave Syer
5556
* @author Juergen Hoeller
@@ -134,7 +135,7 @@ public void setResources(Resource... resources) {
134135
* <p>If no supported types are configured, only Java standard classes
135136
* (as defined in {@link org.yaml.snakeyaml.constructor.SafeConstructor})
136137
* encountered in YAML documents will be supported.
137-
* If an unsupported type is encountered, an {@link IllegalStateException}
138+
* If an unsupported type is encountered, an {@link ComposerException}
138139
* will be thrown when the corresponding YAML node is processed.
139140
* @param supportedTypes the supported types, or an empty array to clear the
140141
* supported types
@@ -175,12 +176,12 @@ protected void process(MatchCallback callback) {
175176
/**
176177
* Create the {@link Yaml} instance to use.
177178
* <p>The default implementation sets the "allowDuplicateKeys" flag to {@code false},
178-
* enabling built-in duplicate key handling in SnakeYAML 1.18+.
179-
* <p>As of Spring Framework 5.1.16, if custom {@linkplain #setSupportedTypes
180-
* supported types} have been configured, the default implementation creates
181-
* a {@code Yaml} instance that filters out unsupported types encountered in
182-
* YAML documents. If an unsupported type is encountered, an
183-
* {@link IllegalStateException} will be thrown when the node is processed.
179+
* enabling built-in duplicate key handling.
180+
* <p>If custom {@linkplain #setSupportedTypes supported types} have been configured,
181+
* the default implementation creates a {@code Yaml} instance that filters out
182+
* unsupported types encountered in YAML documents.
183+
* If an unsupported type is encountered, an {@link ComposerException} will be
184+
* thrown when the node is processed.
184185
* @see LoaderOptions#setAllowDuplicateKeys(boolean)
185186
*/
186187
protected Yaml createYaml() {

spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@
7474
* servers[1]=foo.bar.com
7575
* </pre>
7676
*
77-
* <p>Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6.
77+
* <p>Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0.
7878
*
7979
* @author Dave Syer
8080
* @author Stephane Nicoll

0 commit comments

Comments
 (0)