Spring in-depth technology (self-made notes)

Source: Internet
Author: User
Tags aop

the architecture of spring


The entire spring framework can be divided into five main modules according to its function, and these five modules provide almost everything needed for enterprise applications, from the persistence layer, the business layer to the presentation layer has the corresponding support, this is why spring is a one-stop framework. IOC and AOP are at the heart of spring.
-Core Modules

? Spring's core module implements the IOC function, which removes dependencies between classes and classes from code, and configures dependency descriptions in a configuration way. By the IOC container is responsible for the creation, management, acquisition etc. of the class. The Beanfactory interface is the core interface of the spring framework and implements many of the core functions of the container.

? The context module is built on the core module, extending the functions of beanfactory, including internationalization, resource loading, mail service, task scheduling and many other functions. ApplicationContext is the core interface of the context module.

? expression language (Language) is an extension of the Unified Expression Language (EL) that supports setting and getting object properties, invoking object methods, manipulating arrays, collections, and so on. It makes it easy to interact with the spring IOC container through an expression.
-AOP Module
? The Spring AOP module provides implementations that meet the AOP Alliance specification, and also integrates ASPECTJ as an AOP language-level framework. The coupling can be reduced by AOP.
-Data Access Integration module

? Transaction module: This module is used for spring management transactions, as long as the spring management objects can get the benefits of spring management transactions, do not need to do transaction control in code, and support programmatic and declarative transaction management.

? JDBC Module: Provides a JBDC sample template that uses these templates to eliminate traditional lengthy JDBC coding and the necessary transaction control, and to enjoy the benefits of spring management transactions.

? ORM Module: Provides seamless integration with the popular "object-relational" mapping framework, including Hibernate, JPA, MyBatis, and more. And you can use Spring Transaction management without additional control of transactions.

? OXM module: Provides a object/xml mapping implementation, mapping Java objects to XML data, or mapping XML data to Java objects, Object/xml mapping implementations include JAXB, Castor, XMLBeans, and XStream.

? JMS module: For JMS (Java Messaging Service), a set of "message producers, message consumers" templates are used to make it easier to use JMS,JMS to send messages between two applications, or distributed systems, for asynchronous communication.
-web Module
? The module is built on the Aoolicationcontext module and provides the functionality of the Web application. such as file upload, Freemarker and so on.
? Spring can integrate MVC frameworks such as Struts2. Spring provides itself with the MVC Framework Spring MVC.
-Test Module
? Spring can perform almost all of the testing work with non-container-dependent programming, supporting test frameworks such as JUnit and testng.

Scope of the Bean

The Bean's scope has an impact on the bean's life cycle and how it is created .

Factorybean

The < bean > in front of us is common bean,spring the bean is instantiated using the reflection mechanism through the Bean's class attribute.
If there are very many bean attributes, we need to write a lot of configuration information. Spring provides a factorybean< T > interface.
We can return a particular bean by implementing the interface.
The interface defines three methods

? T getObject (): Returns the bean instance created by Factorybean.

? Boolean Issingleton (): Determines whether the scope of the created Bean is singleton or prototype

? class<? > Getobjecttype (): Returns the type of Factorybean creation Bean

When the class attribute of our < Bean > tag is implemented with the Factorybean interface, it is not the class itself that is returned by Getbean, but the object returned by the GetObject () method, which is equivalent to GetObject () Method proxies the Getbean ().

Spring in-depth technology (self-made notes)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.