Only use Converters which are @ConfigurationPropertiesBinder qualified

Users sometimes create beans of type Converter and don't expect that to
automatically trigger a cascade of early initialization. This change adds
a qualifier to the Converters that are used by @ConfigurationProperties,
so they can be isolated (and simple).

Fixes gh-2669
This commit is contained in:
Dave Syer
2015-08-26 14:56:21 +01:00
parent 538afc4ab1
commit 67483bb73c
4 changed files with 198 additions and 31 deletions

View File

@@ -761,7 +761,8 @@ The following properties names can all be used:
Spring will attempt to coerce the external application properties to the right type when
it binds to the `@ConfigurationProperties` beans. If you need custom type conversion you
can provide a `ConversionService` bean (with bean id `conversionService`) or custom
property editors (via a `CustomEditorConfigurer` bean).
property editors (via a `CustomEditorConfigurer` bean) or custom `Converters` (with
bean definitions annotated as `@ConfigurationPropertiesBinding`).