I am working on a Spring application that has a large number of beans - in hundreds - and it becomes quite cumbersome to use and document.
I’m interested in any experience that you have with DI-enabled applications with lots of beans, which will help in maintainability, documentation, and general use.
Despite the fact that the Spring application is based on several context files, I am open to listening to suggestions regarding any DI container and about DI in general.
I found the following:
Spring (?) beans. / .. , Intellij Spring, Intellij, . Spring -aware IDE .
, Spring XML.
:
<beans> <!-- Scans service package looking for @Service annotated beans --> <context:component-scan base-package="my.root.package.service"/> </beans>
package my.root.package.service;
@Service("fooService") public class FooServiceImpl implements FooService{
}
@Autowired , Spring, bean:
package my.root.package.service; @Service("barService") public class BarServiceImpl implements BarService{ //Foo service injected by Spring @Autowired private FooService fooService; //... }
@Wilson Freitas, autowiring. , spring beans, autowired. , " " . , . @Autowiring , xml-based spring, - , IDE .
, , "" , spring. . , ; , , spring. spring , JSR-330 , " " .