Announcement Announcement Module
Collapse
No announcement yet.
injecting applicationContext into a bean? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • injecting applicationContext into a bean?

    Reading the spring documentation I have learned how to inject other dependencies into objects. How would you inject springs application context itself into an object?

    Joshua

  • #2
    your bean should implement
    Code:
      org.springframework.context.ApplicationContextAware

    Comment


    • #3
      Can it be done without inheritance?

      I appreciate the quick reply.

      While I can use your solution in this case, there has to be a way to do this without needing inheritance. Any other ideas?

      Joshua

      Comment


      • #4
        It isn't inheritance.... it''s adding an interface, so it shouldn't break your class hierarchy.

        dw

        Comment


        • #5
          I apologize, I read your earlier post wrong. Thanks for the help.

          Joshua

          Comment


          • #6
            Of course, that only works for beans that come out of a Spring context.

            Just for newbies.... (of which I am too).

            Comment

            Working...
            X