Announcement Announcement Module
Collapse
No announcement yet.
managing directories for properties- and data.xml-files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • managing directories for properties- and data.xml-files

    hi there,

    i'm using spring for some weeks. i'm shure that other people had the same question as me before, but i can't find anything in the documentation or the forum:

    i'm building a new tomcat-application. some settings used in the data.xml-file should be put in a properties-file for easy configuration.

    my directory structure is:
    ./WEB-INF/classes/bam-data.xml
    ./bam.properties

    this works in tomcat but there are two problems:
    1 having the properties in the home directory of the application isn't nice and i don't get tomcat to accept any other directory.
    2 if i wan't to unit-test bam-data.xml i get an error because the properties-file isn't found.

    if someone can help me just for the second point s/he would really help me. but what i really would like to have is the following directory structure working in tomcat and with unit-testing:
    ./WEB-INF/conf/bam-data.xml
    ./WEB-INF/conf/bam.properties

    thanks a lot, andreas

  • #2
    partial solution

    what i found out, is that this works:
    instead of using an ApplicationContext in Testing/main() this does the job:

    XmlBeanFactory factory = new XmlBeanFactory( new FileSystemResource(confSubDir+"bam-indexer-data.xml"));
    PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
    cfg.setLocation( new FileSystemResource(confSubDir+"indexDirectories.pr operties"));
    cfg.postProcessBeanFactory(factory);

    Does anybody know a solution with ApplicationContext?

    Thanx, Andreas

    Comment

    Working...
    X