When I want to config icon or image properties, I need a image reference, at the moment, I use MethodInvokingFactoryBean to invoke imageSource.getImage(), here is how I did it:
I think if we have some sort of property editors, it would be so much easier, also, I'm just wondering is this the right way to inject image/icon at this stage?Code:<bean class="com.MyBean"> <property name="icon"> <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetObject" ref="imageSource"></property> <property name="targetMethod" value="getImage"></property> <property name="arguments"> <list> <value>middle.icon</value> </list> </property> </bean> </property> </bean>


Reply With Quote