You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Varun Deep <vd...@ygconsultants.com> on 2008/06/02 18:12:31 UTC

read property file in spring

Hello to everyone,
 
Friends, I am using struts2 + spring, I want to read the
"mail.properties" (which is in WEB-INF/classes/mail.properties) file in
the spring. Follwing is the syntax that I am using.
 
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfi
gurer">
            <property name="location" value="classpath:mail.properties"
/>                
      </bean> 
 
<bean id="sendMail"
            class="com.employee.action.SendMail">
            <property name="host" value="${mail.host}" />
            <property name="from" value="${mail.from}" />
            <property name="subject" value="${mail.subject}" />
      </bean>
 
but this is giving me error.
Can any one please suggest me in detail that how can I sought this
problem. Please help.
 
Thanks in advance
Varun
 

RE: read property file in spring

Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Varun-

I would make sure your applicationContext.xml defines the PropertyPlaceHolderConfigurer attributes as in
<beans>
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>WEB-INF/mail.properties</value>
......
            </list>
        </property>
    </bean>

and that your fully configured mail.properties is located in WEB-INF folder..

Anyone?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> From: vdeep@ygconsultants.com
> To: user@struts.apache.org
> Subject: read property file in spring
> Date: Mon, 2 Jun 2008 21:42:31 +0530
> 
> Hello to everyone,
>  
> Friends, I am using struts2 + spring, I want to read the
> "mail.properties" (which is in WEB-INF/classes/mail.properties) file in
> the spring. Follwing is the syntax that I am using.
>  
> <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfi
> gurer">
>             <property name="location" value="classpath:mail.properties"
> />                
>       </bean> 
>  
> <bean id="sendMail"
>             class="com.employee.action.SendMail">
>             <property name="host" value="${mail.host}" />
>             <property name="from" value="${mail.from}" />
>             <property name="subject" value="${mail.subject}" />
>       </bean>
>  
> but this is giving me error.
> Can any one please suggest me in detail that how can I sought this
> problem. Please help.
>  
> Thanks in advance
> Varun
>  

_________________________________________________________________
Suspicious message? There’s an alert for that. 
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008