Application analysis of Spring Framework transaction management

Source: Internet
Author: User
Tags aop

Introduction

In software development has been a variety of frameworks, the rise of open source software, so that a variety of frameworks appear, for example, under the Apache organization has a lot of frame-like products. A framework is a set of collaborative classes that build a reusable design for a particular type of software. However, the traditional framework makes the application components too dependent on the classes in the framework, which reduces the reusability of the components. The advent of the spring framework makes it possible to have more loose coupling between components.

Introduction to the Spring framework

The spring Framework is a February 2003-year open source project that originated from Rod Johnson's basic code in the book "Expert one-on-one Java design and Development", which was published at the end of 2002. In the book, Rod Johnson advocates a pragmatic design idea for Java, and the spring framework is the more comprehensive and concrete implementation of this idea. The spring framework consists of a container, a framework for configuring and organizing components, and a set of built-in services for transactions, persistence, and Web user interfaces. As a lightweight Java EE framework, Spring provides an efficient way to build and organize Java EE applications.

1. Spring Features

The IoC (inversion of control inversion), also known as DI (Dependency injection; Dependency injection), is the emerging programming idea in the object-oriented domain, and the essence of spring. In short, the IOC means that the relationship between programs is controlled by the container, not by the program code in the traditional implementation. This is the so-called "control reversal" of the concept is: control from the application of the code to the external container, the transfer of control, which is called inversion. The IOC moved the responsibility created by the control into the framework and separated it from the application code. When you use spring's IOC container, you only need to point out the objects that the component needs, and the IOC container for spring at run time is provided to it based on the XML configuration data.

The Spring IoC, with its reliance on injection design patterns, allows developers to ignore the extreme relationships of the object's own lifecycle and to improve the developer's use of the pattern. Management of an object is not difficult, it is difficult to manage the entire object group. Dependency injection allows the container to manage objects, that is, "Don t call me, I'll call you". The life cycle of the object itself and the relationship between objects no longer bother the developer.

Spring AOP, with the help of spring implementation interceptors, enables developers to achieve a reputation for using enterprise-class services, such as security services, transactional services. AOP is a reasonable complement to OOP, and with spring AOP, developers are able to efficiently use the Java EE service.

The spring service abstraction, aided by various Java EE API abstractions, allows developers to consistently use the Java EE technology, regardless of the Java API, with the spring service abstraction, which greatly reduces the code to meet "less code, fewer bugs" software design principles.

Spring ioc+spring aop+spring Service abstraction, which forms spring, an organism that makes it possible to build lightweight Java EE.

Transaction management provided by spring

The transaction management provided by spring can be divided into two categories: programmatic and declarative. Programmatic, more flexible, but a large number of code, there are more than duplicate code, declarative more flexible than programmatic.

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.