Announcement Announcement Module
Collapse
No announcement yet.
Config file applicationContext.xml into a .jar file. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Config file applicationContext.xml into a .jar file.

    Hello to all. How i can to configure an ApplicationContext (may be ClassPathXmlApplicationContext?) if the configuration file (applicationContext.xml) is in a jar file within the classpath but outside the ear?

  • #2
    You can use the classpath: prefix to tell Spring to load from the classpath. ClassPathXmlApplicationContext loads from the classpath anyway, but the classpath: prefix also works in WebApplicationContext implementations.

    Normally EARs should be self-contained: that's the intent of the J2EE spec. However, to meet one unusual requirement I used the classpath: mechanism to load a config file in a JAR on the Tomcat shared classpath; it works fine.

    Comment


    • #3
      Originally posted by Rod Johnson
      You can use the classpath: prefix to tell Spring to load from the classpath. ClassPathXmlApplicationContext loads from the classpath anyway, but the classpath: prefix also works in WebApplicationContext implementations.
      ok, i will try with this, thanks

      Originally posted by Rod Johnson
      Normally EARs should be self-contained: that's the intent of the J2EE spec. However, to meet one unusual requirement I used the classpath: mechanism to load a config file in a JAR on the Tomcat shared classpath; it works fine.
      Yes, i agree with you. In jar we have configuration files of services. We have separated jar of ear for being able to modify the configuration files and that the services are reshaped.

      Thanks for your time, and excuse me for my english.

      Comment

      Working...
      X