Announcement Announcement Module
No announcement yet.
How can a bean reference back to its context Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Answer to your question:

    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.