Something about Nothing

some thoughts about nothing

Injecting .properties file in Spring

without comments

A few days back I came across a piece of code from Spring here it is :


<bean
id=”propertyConfigurer” class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
    <property name=”locations”>
      <list>       
        <value>classpath:file.properties</value>
        <value>classpath:validation.properties</value>
      </list>
    </property>
</bean>

Now, what this enables us to do is to inject the values from property file in to Spring Beans, neat isn’t it ?

<bean id=”fileProcessor” class=”a.b.c.d.SomeImpl”>
<
property name=”srcFileName” value=”${file.srcFileName}”/>
</bean>

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • e-mail
  • Furl

Written by mansoor

August 8th, 2007 at 9:42 am

Posted in Default

Leave a Reply