Skip to content

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

Closed
@burkedavison

Description

@burkedavison

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions