Spring3之 bean简单属性注入
DI (依赖注入)有二种: Constructor-based dependency injection and Setter-based dependency
a)、Constructor-based? DI
com.spring305.test.beanInit.po.InitSingeBean.java
?
?b)、Setter-based? DI
XML
到底使用哪种来注入?Spring3官方文档:
<!--EndFragment-->
it is a good rule of thumb to use constructor arguments for mandatory dependencies and setters for optional dependencies。....The Spring team generally advocates setter injection?关于一般属性的注解现没在文档上找到。。。估计那样也没多大意义。。。
?