Description
Overview
Since SnakeYaml allows for custom types to be loaded when they are specified inside the YAML document, we should make it possible to configure the types that can be constructed.
Proposal
Provide a mechanism in YamlProcessor
for configuring the supported custom types for the Yaml
instance created in org.springframework.beans.factory.config.YamlProcessor.createYaml()
.
For example, a new void setSupportedCustomTypes(Class<?>... types)
method could be added to YamlProcessor
. If no supported types are configured, the Yaml
instance would be created as it is currently, without any restrictions. If supported types have been configured, the Yaml
instance would be created with restrictions in place. The TypeLimitedConstructor
recently introduced in Spring Boot can serve as inspiration for the latter.