Skip to content

Spring Config does not use environment conversion service on resolved properties #39944

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
burkedavison opened this issue Mar 14, 2024 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@burkedavison
Copy link

When ConfigurationPropertySourcesPropertyResolver resolves a property, it calls AbstractPropertyResolver.convertValueIfNecessary() which uses a ConversionService to produce the target type. This allows types such as com.google.protobuf.ByteString to invoke a custom method such as toStringUtf8 rather than toString to produce its String representation.

When ConfigDataEnvironmentContributorPlaceholdersResolver resolves a property, it calls String.valueOf() - bypassing any registered converter.

Original issue describing specific use case: GoogleCloudPlatform/spring-cloud-gcp#2690

Affects Spring Boot 2.4.x - 3.2.x.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 14, 2024
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Mar 15, 2024
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Mar 20, 2024
@philwebb philwebb added this to the 3.3.x milestone Mar 20, 2024
@philwebb
Copy link
Member

We think this is a bug, however, we've had lots of issues in the past with the conversion service causing unexpected problems when we change things. We're specifically worried that someone might get an unwanted conversion.

We're going to try and fix this in 3.3 and see if it causes any problems for folks that upgrade. If it doesn't we can consider backporting the fix later.

@mhalbritter mhalbritter modified the milestones: 3.3.x, 3.3.0-RC1 Mar 28, 2024
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

4 participants