Results 1 to 6 of 6

Thread: FilterToBeanProxy with ClassPathXmlApplicationContext

  1. #1
    Join Date
    Aug 2005
    Posts
    3

    Default FilterToBeanProxy with ClassPathXmlApplicationContext

    I searched the forums, the docs and checked the code and it appears there is no way to use FilterToBeanProxy with an ApplicationContext that I have constructed via the ClassPathXmlApplicationContext.

    If this is not possible, is it a bad idea? I would be happy to suggest a patch that would allow configuring the proxy with a provided context. Is there something else I should try instead of the FTBProxy?

    My issue stems from the fact that I use Acegi but the context must be built into the jar with the code that it wires.

  2. #2
    Join Date
    Oct 2004
    Posts
    207

    Default

    Having your application context xml in your jar/classpath is a perfectly legitimate requirement. It does not mean you need to use the ClassPathXmlApplicationContext though.

    In your web.xml you can configure the ContextLoaderListener to load the application xml out of the classpath.

    Code:
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath&#58;applicationContext.xml</param-value>
        </context-param>
    
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

  3. #3
    Join Date
    Aug 2005
    Posts
    3

    Default

    Thanks, that is what I ended up finding was possible after trying some truly horrendous stuff.

  4. #4
    Join Date
    Apr 2005
    Location
    Brussels, Belgium
    Posts
    100

    Default

    I'm very interested in that feature, because my application context configuration file is not in WEB-INF as most tutorials suggest, but rather inside a jar that contains all my service and data layer stuff.

    Can anyone confirm that:
    1 - this feature is still available is recent versions of acegi (as the message is dated in 2004) ?
    2 - that with this syntax, web.xml is able to see applicationContext.xml anywhere on the classpath ?
    Sebastien Arbogast

  5. #5
    Join Date
    Nov 2005
    Location
    inside milk carton
    Posts
    51

    Default

    Yes and Yes. You can reference any context file as long as it's in your classpath by using "classpath:"

  6. #6
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    All Spring ApplicationContexts implements ResourceLoader, which provides resolution of the "classpath:" prefix. This is a Spring-internal feature. Note that you don't need to use ClassPathXmlApplicationContext - any of the ApplicationContext included with Spring support this.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Similar Threads

  1. Minor improvement to FilterToBeanProxy
    By dhewitt in forum Security
    Replies: 1
    Last Post: Feb 24th, 2005, 03:07 PM
  2. Replies: 3
    Last Post: Jan 19th, 2005, 03:21 PM

Posting Permissions

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