Announcement Announcement Module
No announcement yet.
MessageSource properties file loading from a remote location Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageSource properties file loading from a remote location

    Hi All,

    I am using Spring web-mvc in SAP web server. Is it possible to store the properties file in some remote location like in knowledge management of sap and load these files as message resources in spring mvc application.

    As far as I know there is a class ResourceLoader used to load the properties file from class path. I tried extending this class and write my own implementation to get the resources from my file system, but I was not successful.

    here is my resourceLoader method to retrieve resource

    public Resource getResource(String location) {
    		System.out.println("KMResourceLoader getResource:" + location);
    		File file = new File("D:/test/" + location + ".properties");
    		MessageResource messageResource = new MessageResource(file);
    		messageResource.setLastModified(new Date().getTime());
    		return messageResource;
    In the above code MessageResource is a custom class that implements Resource and extends AbstractResource.

    here is my configuration for messageSource
    <bean id="messageSource" class="">
    		<property name="defaultEncoding" value="UTF-8"></property>
    		<property name="resourceLoader" ref="kmResourceLoader"></property>
    		<property name="basenames">
    Please advice me on this

  • #2
    Is someone there to help me ?


    • #3
      you cannot use the resourceLoader

      The ResourceLoader got overridden during application context initialization with a XmlWebApplicationContext (or the applicationContext your application is runing in) because it implements the 'ResourceLoaderAware' interface.