Topic
  • 2 replies
  • Latest Post - ‏2012-11-20T21:36:13Z by SystemAdmin
SystemAdmin
SystemAdmin
590 Posts

Pinned topic Failed to load properties into spring bean - file path issue

‏2012-11-20T06:39:37Z |
Following configuration is not loading environment.properties file.
<init-param>
<param-name>configLocation</param-name>
<param-value>file:${configuration.home}/environment.properties</param-value>
</init-param>
"configuration.home" configured at system enviroment properties and also at "bootstrap.properties"
But "${configuration.home}" this is not working as a placeholder, instead its just working as simple string and passed to file path.

Ex:
Expected file path should be like this:
path = D:\config\environment.properties
instead its coming like this.
path = file:${configuration.home}/environment.properties

Example configuration.
<filter>
<filter-name>managementServiceSecurityFilter</filter-name>
<filter-class>platform.services.management.security.BasicAuthenticationFilter</filter-class>
<init-param>
<param-name>defaultValues</param-name>
<param-value>classpath:management-service.properties</param-value>
</init-param>
<init-param>
<param-name>configLocation</param-name>
<param-value>file:${configuration.home}/environment.properties</param-value>
</init-param>
</filter>
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Failed to load properties into spring bean - file path issue

    ‏2012-11-20T06:55:08Z  
    Spring version - 3.0.5
    Liberty version - 8.5.0.0

    Thanks in advance.
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Failed to load properties into spring bean - file path issue

    ‏2012-11-20T21:36:13Z  
    Spring version - 3.0.5
    Liberty version - 8.5.0.0

    Thanks in advance.
    Hello,

    I'm afraid that liberty doesn't support expansion of variables in the web.xml file, so the value of ${configuration.home} needs to be explicitly coded. If you need to specify such values as configurable variables you could change the application to use jndi entries and specify the values in the server.xml using variables.

    Regards, Alex.