Announcement Announcement Module
Collapse
No announcement yet.
Access application context from code without servlet context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Well, it's a bit of a conceptual shift, but you will (eventually/hopefully come to see the world turn round in such a way that you use Spring/IoC essentially for *everything*, and not worry about questions like "If I have code wanting to use this NonSpringFactory, how does it get a reference to the factory" - yes, the answer is always the same, "by Injection" :P The point is that Spring spreads "everywhere", like a virus - the real benefits of IoC only occur once it is spread across an entire design (the 80/20 rule - 80% adoption only gives 20% of the benefits).

    Singleton-accessors (getInstance()) are the old-fashioned, poor programming practice that Spring and in general IoC programming replaces.

    It's not that "Spring takes away the direct benefit of a factory", but actually disables the poorer programming practices that involve trying to use it directly. The ability to "ask for things" always creates a dependency, whereas "just getting them" removes it - since they could have been "just given to you" in practically any way (not even necessarily involving Spring, but in fact any IoC framework, or even manually, by code). Something that you can "ask for", you can get in only one way.

    As you're finding, with current Spring architecture, IoC has to generally "stop" at some barrier caused by a scope-change, but even this barrier can now be breached by more recent developments such as Spring 2.0's bean scopes, or RSF's request-scope beans.

    Comment


    • #17
      Bosman, and everyone else who has contributed, thanks a lot for your valuable comments. Just as the last post of Bosman suggests, I've also come to the conclusion that there should be no "non-Spring" section/layer in an application if somehow possible.

      For me, that concludes this discussion.

      Cheers
      Simon

      Comment

      Working...
      X