Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refactor a codebase that uses spring autowiring

I've inherited two fairly non-trivial codebases that uses spring for configuring the applications. Now I need to reconfigure the applications. But lots of the configuration is provided through autowiring so it is almost impossible to find out what the actual configuration is.

The projects are moderately sized, some 20-ish maven modules per project including integration test modules and such. Most modules define a few application contexts for various purposes, that contain one or two local spring config files along with one or two from the core modules it depends on. The result is a myriad of configurations, and that I cannot alter a class or variable name (or setter method) without risking breaking dependencies in some upstream or downstream module, even if no such dependency is visible anywhere in the project.

How do I work effectively with autowired dependencies in spring?

Can anyone, perhaps someone who actually likes autowiring, provide some insight into how you work with them effectively?

(I also inherited a small project that combines xml-files, autowiring and annotation-driven config, making dependency relations completely intractable, but I'll save those annotations for a separate question later)

like image 950
eirikma Avatar asked Jan 19 '11 17:01

eirikma


1 Answers

You can perform re-factoring of auto wired beans using Intellij (I have version 9 Ultimate). Also Intellij has an option of making autowiring dependencies explicit. Link Provided below

http://blogs.jetbrains.com/idea/2009/03/making-spring-autowired-dependencies-explicit/

like image 80
uncaught_exceptions Avatar answered Sep 23 '22 03:09

uncaught_exceptions