diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java index cb6c2f16d5..1d9732a043 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlMapFactoryBean.java @@ -64,7 +64,7 @@ import org.springframework.lang.Nullable; * Note that the value of "foo" in the first document is not simply replaced * with the value in the second, but its nested values are merged. * - *
Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. + *
Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0. * * @author Dave Syer * @author Juergen Hoeller diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java index d01e96bcf7..8c858d8a7b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java @@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFactory; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.composer.ComposerException; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.inspector.TagInspector; import org.yaml.snakeyaml.nodes.Tag; @@ -49,7 +50,7 @@ import org.springframework.util.StringUtils; /** * Base class for YAML factories. * - *
Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. + *
Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0. * * @author Dave Syer * @author Juergen Hoeller @@ -134,7 +135,7 @@ public abstract class YamlProcessor { *
If no supported types are configured, only Java standard classes * (as defined in {@link org.yaml.snakeyaml.constructor.SafeConstructor}) * encountered in YAML documents will be supported. - * If an unsupported type is encountered, an {@link IllegalStateException} + * If an unsupported type is encountered, an {@link ComposerException} * will be thrown when the corresponding YAML node is processed. * @param supportedTypes the supported types, or an empty array to clear the * supported types @@ -175,12 +176,12 @@ public abstract class YamlProcessor { /** * Create the {@link Yaml} instance to use. *
The default implementation sets the "allowDuplicateKeys" flag to {@code false}, - * enabling built-in duplicate key handling in SnakeYAML 1.18+. - *
As of Spring Framework 5.1.16, if custom {@linkplain #setSupportedTypes - * supported types} have been configured, the default implementation creates - * a {@code Yaml} instance that filters out unsupported types encountered in - * YAML documents. If an unsupported type is encountered, an - * {@link IllegalStateException} will be thrown when the node is processed. + * enabling built-in duplicate key handling. + *
If custom {@linkplain #setSupportedTypes supported types} have been configured, + * the default implementation creates a {@code Yaml} instance that filters out + * unsupported types encountered in YAML documents. + * If an unsupported type is encountered, an {@link ComposerException} will be + * thrown when the node is processed. * @see LoaderOptions#setAllowDuplicateKeys(boolean) */ protected Yaml createYaml() { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java index 71088f17f0..48d0e2a4f6 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ import org.springframework.lang.Nullable; * servers[1]=foo.bar.com * * - *
Requires SnakeYAML 1.18 or higher, as of Spring Framework 5.0.6. + *
Requires SnakeYAML 2.0 or higher, as of Spring Framework 6.1.0. * * @author Dave Syer * @author Stephane Nicoll