Announcement Announcement Module
Collapse
No announcement yet.
Refactoring an existing infrastructure to use Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refactoring an existing infrastructure to use Spring

    I'm about to introduce Spring into our existing framework, of which there's a lot of existing code. This already does a lot of IoC type stuff, but with dependency lookup, instead of injection. The aim of the game is to bit-by-bit replace our own IoC with Spring's, leveraging the dependency injection.

    What's the best approach to using Spring bean factories and the assoicated resources in a legacy framework? Holding references to factories seems to be the main issue.

    Despite the warnings in the JavaDoc, the best approach seems to be to use SingletonBeanFactoryLocator. Our app consists of lots of modules, with a strictly-defined dependency hierarchy. By using SingletonBeanFactoryLocator as the access point for components created from Spring resources, this seems to give the best way of associate disparate beans.xml config files between modules that may depend on each other.

    Unless there's another way?

  • #2
    You might also want to look at the ApplicationContextAware interface which would allow select object's to get a reference to the context, and pull Beans from it.

    Comment

    Working...
    X