Results 1 to 2 of 2

Thread: How can a bean reference back to its context

  1. #1

    Default How can a bean reference back to its context

    For a bean which is instantiated via the context.getBean() method, how can it reference back to its parent context? I want to use the context to create additional beans, from within a bean which was created as above. I know I can do it by referring to another ApplicationContext.xml, but I'd like to define all of the beans once, in a single xml file.

  2. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Answer to your question:
    http://www.springframework.org/docs/...textAware.html

    But normally you don't implement such interfaces on your objects (objects remain totally unaware of Spring). I don't know enough about your problem, but I think a different approach would be better.

Posting Permissions

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