Results 1 to 4 of 4

Thread: Can we Share ClasspathXMLApplicationContext

  1. #1

    Default Can we Share ClasspathXMLApplicationContext

    Hi..i have a few properties file which i want to share in different projects (these all projects run in same app server). i am putting thse files in my classpath as in

    <value>classpath*:/**/mydirpath.props</value>

    so that now when i create a ClasspathXMLApplicationContext object ApplicationContext context = new ClasspathXMLApplicationContext ("mydirpath.props");
    i will get a context object. now i want to share this context object with other projects (which can be web or simple java projects, but they all run in the same app server). is it possible...if yes then How to do it ??

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    There is nothing to stop you from instantiating an application context multiple times. This is in fact how the AbstractSessionBean subclasses work by default.

    If you want to have several projects share the same INSTANCE of an application context, you can use SingletonBeanFactoryLocator.

  3. #3

    Default

    now when i say
    ApplicationContext context = newClassPathXmlApplicationContext("mydirpath.props ");
    its saying that it cannot find mydirpath.props ....why is it so...
    i have delcated this mydirpath.props in the classpath of a different project. But both these projects run in the same app server.

  4. #4
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    ClassPathXmlApplicationContext is for XML files. You need to use an application context which utilizes property files:

    Check out the javadoc for GenericApplicationContext. It has an example of loading a property file from the classpath.

Similar Threads

  1. Replies: 1
    Last Post: Jul 3rd, 2005, 03:14 PM
  2. Replies: 0
    Last Post: Apr 6th, 2005, 08:24 AM
  3. Replies: 1
    Last Post: Jan 22nd, 2005, 02:45 AM
  4. Share data beteween two Views
    By genepi in forum Swing
    Replies: 0
    Last Post: Jan 10th, 2005, 05:01 AM
  5. Replies: 2
    Last Post: Sep 28th, 2004, 11:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •