开发者

Data binding with property editors when application context loads up

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜