The two sides of coupling
On the one hand, the code coupling is difficult to test, there will be hit the mouse-style bug feature (fix a bug, raise another bug) on the other hand, the coupling is necessary, different classes must be appropriate to interact, in order to achieve the function. Four ways to assemble beans
Byname,bytype,constructor,autodetect (first attempt constructor, after failure using Bytype) annotation method injection: When the bean is automatically injected with annotations such as @resource or @autowired, it is possible that spring lacks a bean suitable for automatic assembly, or that more than one bean can be assembled without fully satisfying the assembly conditions. Resolve the lack of automatic assembly of Beans: @Autowired (required=false) to resolve too many beans to satisfy the condition: @[email protected] ("Guitar") Spring AOP Spring is based on dynamic proxy, Therefore, only the method connection point is supported and no fine-grained notifications can be created, for example, when a field is modified, the constructor connection point is not supported, and the notification cannot be applied when the bean is created. When a method call is intercepted, the agent executes the tangent logic before invoking the target bean.
Spring in Action notes