AOPallows developers to create non-behavioral concerns, called crosscutting concerns, and insert them into application code. UseAOPafter the public service (Thansuch as logs, persistence, transactions, etc.) can be decomposed into facets and applied to domain objects without increasing the complexity of the object model of the domain object.
IOCallows you to create an application environment where objects can be constructed, and then pass their collaboration objects to those objects. As the wordInvertedshows,IOCjust like the anti- come on.JNDI. Not using a bunch of abstract factories, service locators, single elements (Singleton) and direct construction (Straight Construction), each object is constructed by their collaboration objects. Therefore, the container manages the collaboration objects (collaborator).
Springeven aAOPframework, is also aIOCcontainer. Springthe best place is that it helps you replace objects. With theSpring, just useJavaBeanattributes and configuration files join dependencies (collaboration objects). You can then easily replace collaboration objects with similar interfaces when you need them.
This article comes from "Striving for the dream!" "Blog, be sure to keep this provenance http://zhuiqiuuuu.blog.51cto.com/8372008/1638807
Why do you use Spring