Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ protected ConfigurablePropertyResolver createPropertyResolver(MutablePropertySou
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess,
ConfigurablePropertyResolver propertyResolver) throws BeansException {

if(this.environment instanceof ApplicationServletEnvironment) {
propertyResolver.setConversionService(((ApplicationServletEnvironment) this.environment).getConversionService());
}

Copy link
Member

@sbrannen sbrannen May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (this.environment instanceof ConfigurableEnvironment configurableEnvironment) {
propertyResolver.setConversionService(configurableEnvironment.getConversionService());
}

I looked into a possible fix before looking at your proposal, and I first came up with the analogous solution above.

We cannot use ApplicationServletEnvironment here, since that class is specific to Spring Boot and Servlet deployments.

Thus, downcasting to ConfigurableEnvironment using instanceof pattern matching would be the correct way to do that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks something didn't feel right with the change I made

propertyResolver.setPlaceholderPrefix(this.placeholderPrefix);
propertyResolver.setPlaceholderSuffix(this.placeholderSuffix);
propertyResolver.setValueSeparator(this.valueSeparator);
Expand Down