Results 1 to 3 of 3

Thread: Need access to ApplicationContext from outside of Views

  1. #1
    Join Date
    Aug 2004
    Location
    Mainz, Germany
    Posts
    42

    Default Need access to ApplicationContext from outside of Views

    I'm in the middle of porting an application to spring rich (and spring) and have places in my code, where I would like to instantiate beans which are defined in my xml context files.

    When I'm inside of classes which extend ApplicationServicesAccessorSupport, there is no problem, I just use the protected getApplicationContext().getBean(String).

    But, when I want to do the same in my 'legacy' code, I'm stuck. Or maybe I'm just too dumb to find the correct way.

    A static method like Application.getContext() would help a lot, but Spring people don't use 'static', do they ? :wink:

    Any hint is appreciated.

    Thanks

    Kambiz

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Application.services().getApplicationContext() should work!
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Aug 2004
    Location
    Mainz, Germany
    Posts
    42

    Default Re: Need access to ApplicationContext from outside of Views

    Quote Originally Posted by darabi
    ... Or maybe I'm just too dumb to find the correct way.
    I knew that :-)

    Thank you, Keith

    Kambiz

Similar Threads

  1. Replies: 4
    Last Post: Jun 4th, 2011, 11:56 AM
  2. Replies: 2
    Last Post: Apr 22nd, 2009, 10:02 PM
  3. Replies: 2
    Last Post: Oct 13th, 2005, 09:58 AM
  4. Replies: 6
    Last Post: Jun 1st, 2005, 04:57 PM
  5. Replies: 2
    Last Post: Apr 2nd, 2005, 11:44 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
  •