I understand the principle of data binding of properties onto target with custom or 开发者_StackOverflow中文版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[].
The answer is right here and here in spring documentation.
See:
PropertyEditorRegistrySupport.createDefaultEditors();
精彩评论