Results 1 to 6 of 6

Thread: injecting applicationContext into a bean?

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Posts
    11

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    your bean should implement
    Code:
      org.springframework.context.ApplicationContextAware
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Sep 2004
    Posts
    11

    Default 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

  4. #4
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    1

    Default

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

    dw

  5. #5
    Join Date
    Sep 2004
    Posts
    11

    Default

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

    Joshua

  6. #6
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

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

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

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 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
  •