Possible Duplicate:
replace <constructor-arg> with Spring Annotation
i would like to replace an XML applicationContext configuration by an annotation.
How to replace a simple bean with constructor arguments which are fixed ?
Exemple :
<bean id="myBean" class="test.MyBean">
<constructor-arg index="0" value="$MYDIR/myfile.xml"/>
<constructor-arg index="1" value="$MYDIR/myfile.xsd"/>
</bean>
I’m reading some explanation on @Value, but i don’t really understand how to pass some fixed values…
Is it possible to load this bean when the web application is deployed ?
Thank you.
I think what you are after is this:
You also might want these files to be configurable via system properties. You can use the
@Valueannotation to read system properties using thePropertyPlaceholderConfigurer, and the${}syntax.To do this, you can use different
Stringvalues in your@Valueannotation:but you will also need these properties in your system properties: