Reading property file in java using Spring -


  1. have been trying understand how load property file using spring in java , populate java.util.properties object.
  2. use newly created property object constructor arguement bean.

appreciate pointers on this.

thanks, cabear

to load properties file in spring use propertiesfactorybean make easier use there properties tag in util namespace can use.

<util:properties id="props" location="location-of.properties" /> 

then have bean named props can use regular bean.

<bean id="otherbean" class="my.app.myclass" >     <constructor-arg ref="props" /> </bean> 

when using property placeholder support use same properties object again instead of loading again, referencing using properties-ref attribute of property-placeholder tag.

<context:property-placeholder properties-ref="props" /> 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -