Skip to content

Converters added directly to the bean factory's conversion service are not used for property binding when @ConfigurationPropertiesBinding bean is defined #26089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
philwebb opened this issue Apr 14, 2021 · 0 comments
Labels
type: bug A general bug
Milestone

Comments

@philwebb
Copy link
Member

Currently If @ConfigurationPropertiesBinding beans are detected then a new ConverterService is created for use with the binder. This means that any converters added to the BeanFactory converter service will not apply. We mostly got away with this in 2.4 because ApplicationConverterService.getSharedInstance() was used with both the BeanFactory and the Binder. In addition it used to be possible to modify the shared instance which means the bug would only appear if @ConfigurationPropertiesBinding beans were used and if the BeanFactory conversion service has been customized (see this part of the code).

Although this bug is present in 2.4.x, I think we should only apply the fix in 2.5.0. It's requires some quite invasive changes.
It's also more critical in 2.5 since #26088 will change the shared instance to be unmodifiable.

See #24891 for an example of this bug manifesting itself with Spring Security.

@philwebb philwebb added the type: bug A general bug label Apr 14, 2021
@philwebb philwebb added this to the 2.5.x milestone Apr 14, 2021
philwebb pushed a commit that referenced this issue Apr 14, 2021
Add tests to ensure that RSA key converters can be used with an
auto-configured security setup.

See gh-26089
Closes gh-24891
@philwebb philwebb modified the milestones: 2.5.x, 2.5.0-RC1 Apr 14, 2021
@wilkinsona wilkinsona changed the title Allow @ConfigurationPropertiesBinding converts to be combined with a customized BeanFactory ConversionService Converters added directly to the bean factory's conversion service are not used for property binding when @ConfigurationPropertiesBinding bean is defined Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant