No new technique is born, its germination or embryo is always more or less displayed in the previous technology, and the Jive Forum is a design model for everyone to study. Column.
JIVE and Spring are the J1E Web system consisting of Javabeans, and JIVE is an early successful design case, and its main architecture has become a popular architecture of most pure JavaBeans systems, and Spring is no exception.
The Spring framework has a web layer application framework, and also provides an interface to the EJB layer, as well as a direct operation of JDBC / ORM. The main charm of the Spring framework is to use IOC mode and AOP to implement the generic features of the JIVE system, allowing Jive's pure JavaBeans architectures to be reused in other systems.
If you feel emotional design philosophy, but it is hard to reuse its design, the Spring framework has been implemented.
At the same time, it should also be noted that the Spring framework is similar to "chowge", which contains a lot of J2EE applications, such as calls to EJB, its MVC and Struts JSF are also competitive, in pure IOC and AOP design, Spring framework It is also a Heavy, Weight framework. The Spring framework is complicated. If you want to replace EJB with Spring, then it is undoubtedly a hoist floating.
Connecting the Jive Forum and Spring framework, which helps more understanding the design model quickly masters the latest design trend, rather than a jumping forced acceptance. If you have a good study on Jive, it will find that the Spring framework is a more common improvement in jive design.
In Jive, ForumFactory is the entrance and breakthrough of the entire system. JIVE will control the entire system in a factory mode via FORUMFACTORY, which is easy to control the JavaBeans of the system, for example, the client can create a forum through ForumFactory. Access a Forum, but is there any permissions access? As shown below:
JIVE boots this access to the corresponding proxy class, such as the ForumFactoryProxy class, etc., and controls these classes through proxy mode. This is a major use of proxy mode, but studying Jive agent will find that a proxy class is to be implemented for each class, very trivial, is there a more elegant way? Of course use dynamic agents.
The Spring framework is basically abstract above, the Spring Framework is based on all JavaBeans management is also based on a total portal bean factory mechanism. Different, beanfactory can manage all applications JavaBeans, users just tell BeanFactory through the configuration file, then BeanFactory will load these JavaBeans, for example:
Since the Spring framework is also loaded with a bean factory, how is it loaded? Through IOC mode, dependent injection mode is also. In my previous article "IOC mode", I compare the difference between the Factory plant model creation object and the IOC mode, IoC is more decoupled, and more decoupled more than the factory model, and the call relationship between the caller, With IOC mode, there is no need to refer to the specific implementation of the caller in the caller code.
The Spring framework can not only use JavaBeans (which is to create them) to their own containers, but also to these javabeans to implement data assignments through the SET method.
Once Bean Factory runs, Spring provides access, transaction locks, such as universal functions such as permission access, transaction locks, etc., and dynamic agents, this implementation is based on dynamic proxy mode. One way of implementation. As mentioned earlier, JIVE uses proxy mode to implement permission access, more simpler and abstract than the agent model, using dynamic agents will make the caller need to specify an agent class of the caller, this is the nature of the dynamic agent .
This advantage of dynamic agent, but also on another discourse: dynamic agent intercepts the caller of the caller to the caller, which is the interceptor function of the AOP, providing AOP implementation.
The Spring framework uses the dynamic proxy implementation AOP, which is the call to the object of the object under Bean Factory management through dynamic proxy mechanisms. As shown below:
The above is only generally deconsive Spring architecture, and the Spring framework is in this architecture, and there are many other features, such as Web MVC, DAO JDBC, DAO ORM, and Remote, the latter Similar to the EJB method I design..
In short, Spring is indeed the perfect application of IOC and AOP, and IOC is used to load JavaBeans, create these objects; AOP is used to intercept these objects, this is the inevitable classic way of frame design.