Announcement Announcement Module
Collapse
No announcement yet.
How to get an Image bean in spring bean def xmls? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get an Image bean in spring bean def xmls?

    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:

    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>
    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?
Working...
X