-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
In Spring Integration, we have a number of properties that are of type File and can be specified in XML config as a Resource
directory="file:${some.path}"
This works fine in a stand-alone Spring application but not in a Spring Boot application.
Boot adds a conversion service to the bean factory, by default:
if (this.addConversionService) {
context.getBeanFactory().setConversionService(
ApplicationConversionService.getSharedInstance());
}When there is no custom conversion service, the BeanWrapper uses a FileEditor to convert the property; it, in turn, detects the the String is a URL and delegates to a ResourceEditor.
When there is a custom conversion service, it is used by the BeanWrapper instead and it ends up with a java.io.File with the name file:somePath.
The ConversionService uses a simple ObjectToObjectConverter.
So, I believe that Boot's ApplicationConversionService needs a converter than provides similar functionality to the FileEditor PropertyEditor.
Users can .setAddConversionService(false), but that's not a good work-around.