Setting spring bean property value using ref-bean

Posted by Apache Fan on Stack Overflow See other posts from Stack Overflow or by Apache Fan
Published on 2011-01-12T23:24:30Z Indexed on 2011/01/13 4:54 UTC
Read the original article Hit count: 318

Filed under:
|
|

Hi, I am trying to set a property value using spring.

<bean id="velocityPropsBean" class="com.test.CustomProperties" abstract="false" singleton="true" lazy-init="false" autowire="default" dependency-check="default">
    <property name="properties">
   <props>
        <prop key="resource.loader">file</prop>
        <prop key="file.resource.loader.cache">true</prop>
        <prop key="file.resource.loader.class">org.apache.velocity.runtime.resource.loader.FileResourceLoader</prop>
        <prop key="file.resource.loader.path">NEED TO INSERT VALUE AT STARTUP</prop>

    </props>

    </property>
</bean>

<bean id="velocityResourcePath" class="java.lang.String" factory-bean="velocityHelper" factory-method="getLoaderPath"/>

Now what i need to do is insert the result from getLoaderPath into file.resource.loader.path. The value of getLoaderPath changes so it has to be loaded at server startup.

Any thoughts how i can inset the velocityResourcePath value to the property?

© Stack Overflow or respective owner

Related posts about java

Related posts about spring