Announcement Announcement Module
Collapse
No announcement yet.
Using a ResourceBundle in ApplicationContext.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a ResourceBundle in ApplicationContext.xml

    Greetings,

    I was wondering, is there anyway to reference resource bundle text properties like "footer.company.name" in the actual Spring bean XML files i.e. like applicationContext.xml?

    I have the usual ApplicationResource.properties file with name/value pairs i.e.

    Code:
    footer.company.name=Your Company...
    I don't have a problem using them in a Facelets page e.g.
    Code:
    #{text['footer.company.name']}
    with the following loadBundle inside one of the XHTML files...

    Code:
    <f:loadBundle basename="ApplicationResources" var="text" />
    and the JSF faces-config.xml set to

    Code:
    <application><el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
    <locale-config>
    	<default-locale>en</default-locale>
    </locale-config>
    <message-bundle>ApplicationResources</message-bundle>
    </application>

  • #2
    Just in case you still need it:

    HTML Code:
    <bean id="servicePropertyConfig" 
    	class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    	<property name="locations">
    		<list>
    			<value>classpath:properties-file-to-use.properties</value>
    			<value>classpath:another-properties-file-to-use.properties</value>
    		</list>
    	</property>
    	<property name="placeholderPrefix" value="$properties{"/>
    </bean>
    
    ....
    
    <bean id="beanWithAProperty"  class="foo.Class">
    	<property name="propertyToSet" value="$properties{property.from.bundle}"/>
    </bean>
    cheers,
    LK

    Comment


    • #3
      This worked perfectly btw (as you can tell by the delay in responding, it was a low priority to return to this ...

      Comment

      Working...
      X