Results 1 to 3 of 3

Thread: Can WebApplicationContext load context from classpath?

  1. #1
    Join Date
    Jul 2005
    Posts
    2

    Default Can WebApplicationContext load context from classpath?

    Hope this is the right place for this question.

    I have a jar with all my my business/data access code/ and the spring xml files. I took this approach so I can re-use the jar in several web applications (without copying spring xml files in each application).

    Is there any way to use the WebApplicationContext to load spring files from the ClassPath instead of a FileSystem?

    In my web.xml, I tried to setup the ContextLoadListener's context factory class to ClassPathXmlApplicationContext.

    Code:
      <context-param>
        <param-name>contextClass</param-name>
        <param-value>org.springframework.context.support.ClassPathXmlApplicationContext</param-value>
      </context-param>
    
      <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
    But I get an error :
    [org.springframework.context.ApplicationContextExce ption: Custom context class [
    org.springframework.context.support.ClassPathXmlAp plicationContext] is not of ty
    pe ConfigurableWebApplicationContext]
    Has anyone try to do load spring xml files embedded in a jar from a web application? If so, let me know how. Thanks.

  2. #2
    Join Date
    Jul 2005
    Location
    Bearus, Minsk
    Posts
    15

    Default

    is
    Code:
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
    			classpath&#58;/path-to-your-applicationContext-in-classpath.xml
            </param-value>
        </context-param>
    does not working?

  3. #3
    Join Date
    Jul 2005
    Posts
    2

    Default

    thanks, I will try that.

    Never saw this documented (at least in spring online manual).

Similar Threads

  1. Replies: 2
    Last Post: Jan 20th, 2009, 04:33 AM
  2. Replies: 2
    Last Post: Oct 13th, 2005, 02:47 PM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  5. Replies: 6
    Last Post: Jan 19th, 2005, 11:12 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
  •