Is there a shorthand for creating a String constant in Spring context XML file?
java, spring
Solution
A shorthand to the solution proposed by mrembisz goes like this:
<context:property-placeholder properties-ref="myProperties"/>
<util:properties id="myProperties">
<prop key="aSharedProperty">All beans need me :)</prop>
</util:properties>
Problem
I need to define a string value in Spring context XML file that is shared by multiple beans. This is how I do it: ``` <bean id="aSharedProperty" class="java.lang.String"> <constructor-arg type="java.lang.String" value="All beans need me :)"/> </bean> ``` Creating a java.lang.String bean by passing a constructor argument of java.lang.String seems kludgy. Is there a shortcut? I know this property can be passed using PropertyOverrideConfigurer, but I want to keep this property within the XML file.