On Spring @Autowired usage question most of the people answer they prefer not using configuration files, if possible. It seems like a good answer at the first glance.
However, once you have quite a big application which uses Spring IoC and autowires all the stuff using annotations @Autowired, @Service, etc. you m开发者_JS百科ust hit this problem: you no longer are able to keep track of your bean dependencies.
How do you deal with that?Using SpringSource Tool Suite one can create graphs of dependencies on the basis of configuration files.
Is there any tool out there which does the same with @Autowired stuff? (I understand graphs would have to be created on runtime).Implement BeanFactoryAware and cast the factory that is passed into setBeanFactory() to a DefaultListableBeanFactory. Then use DefaultListableBeanFactory.getBeanDefinitionNames() and DefaultListableBeanFactory.getDependenciesForBean() to generate the dependency graph.
精彩评论