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

  • Question pertaining to PropertyPlaceholderConfigurer

    I am currently running inside of JBoss and wish to use an external property file in regards to my ApplicationContext.xml. I don't want to have the properties file inside of my war file.

    I don't know where they are going to install JBoss so I don't know exactly where the properties file is going to be relative to the JBoss install directory. Now I can get the JBoss directory that I need via the system property jboss.server.home.dir but I need to set the location on the PropertyPlaceholderConfigurer inside of my ApplicationContext.xml file.

    I have tried to instantiate the PropertyPlaceholderConfigurer after the application has started and setting the location at that point but how does the ApplicationContext pick up that change since it has already instantiated my other beans with incorrect properties since it didn't know about the properties file. I tried calling postProcessBeanFactory on the PropertyPlaceholderConfigurer but that seems like it is only for XmlBeanFactory and not ApplicationContext.

    Thanks in advance for any help that I receive.

  • #2
    Hmmm. So where is the properties file? What is it relative to? Is it on the classpath? How does the application know where it is? You could specify a system property with the location of the properties file.


    • #3
      The property file would be relative to the deployment directory. Currently we have a directory located under the deployment directory named conf.

      So if we were deploying to the server/default directory located under JBoss it would be the server/default/conf directory. This directory is not currently part of the classpath. If this directory was part of the classpath would I then be able to set the location of the properties file via the location property in the ApplicationContext.xml file? If the answer to the above question is yes how would I go about adding this directory to the classpath?

      Thanks again for the help.


      • #4
        If your directory is always in the same place, couldn't you use a relative path? As for the classpath issue, I'm not really much of a JBoss expert. I'd either cheat and make sure my files are on the classpath, or have a read of the reference manual.