Question

I understand the principle of data binding of properties onto target with custom or default PropertyEditor. You specify a target bean and then bind properties onto it.

What I can't find out is how this binding works in bean definitions. What are the default PropertyEditors that are applied when you do something like this :

custom.property=a,b,c,d

<util:properties id="properties" location="classpath:my.properties" />
<bean class="com.example.SomeType">
    <property name="foo" value="${custom.property}" />
</bean>

And how would I add my custom editor to those applied when app context is being loaded up. In this case for converting string a,b,c,d into string array, because foo is String[].

Was it helpful?

Solution

The answer is right here and here in spring documentation.

See:

PropertyEditorRegistrySupport.createDefaultEditors();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top