Announcement Announcement Module
Collapse
No announcement yet.
Relative PropertyPlaceholderConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Relative PropertyPlaceholderConfigurer

    I'm trying to use a PropertyPlaceholderConfigurer to load a properties file within a WebApp.

    Currently the properties file is in a subdirectory of the XML application context file declaring the PropertyPlaceholderConfigurer. Ideally I would like to define the location of the properties file as 'properties/spring.properties' - as I would have thought this would be relative to where it's declared. Unfortunately this seems to be interpreted (a) not as relative and (b) under a different scheme (i.e. ServletContext in my case) to the application context , which is loaded as a classpath URL.

    Therefore currently I'm having to define the properties location as 'classpath:/my/base/path/properties/spring.properties'. I'd really like to be able to deploy the Spring container either jar'd or with an unjar'd configuration so that I can refer to it anywhere and it's dependent files (i.e. properties file) will be found based upon where it is (i.e. in the subdirectory - possibly in a jar, possibly not).

    Is there any way to achieve this? I think the same problem exists for the <import> elements in a configuration file - ideally these should be importable with a relative path, relative to the importing file.

    Thanks

    _jpg_
Working...
X