Announcement Announcement Module
No announcement yet.
FilterToBeanProxy with ClassPathXmlApplicationContext Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.



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


      • #4
        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 ?


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


          • #6
            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.