Spring Framework Basics

Source: Internet
Author: User
Tags to domain

The Origin and development of the 1.Spring framework:

(1). Spring is the framework for the three classic frameworks of Java Web (Struts, Spring, Hibernate, SSH) that are primarily used to reduce the coupling between modules, and in fact Spring provides additional functionality in addition to the ability to reduce the coupling between modules through the IOC.

(2). In 2002, Rod Johnson published the Expert one to one Java EE Design and development, which challenged the bloated, inefficient and detached realities of the Java EE Framework, and actively sought to explore ways to innovate. With this book as the guiding ideology, he wrote the INTERFACE21 framework, which is an attempt to break through the traditional development of the Java EE Dilemma, starting from the actual needs, focusing on light, agile, easy to develop, test and deployment of a lightweight development framework.

(3). The spring framework, which is based on the INTERFACE21 framework, has been redesigned and enriched, with the introduction of the Spring1.0 Beta version in 2003 and the release of the 1.0 official version on March 24, 2004, the same year that he launched a classic masterpiece, Expert One-to-one development without EJB, the book has made a fuss in the Java world, changing the way Java developers think about programming and development. In this book, the author based on his years of rich practical experience, the EJB's various cumbersome and bloated structure of a one-to-one analysis and negation, and respectively, in a concise and practical way to replace. At this point, Rod Johnson became a master figure who changed the Java world.

(4). Traditional Java EE application development efficiency is low, application server vendors to various technology support is not really unified, resulting in the application of the Java EE does not really achieve "write once, run everywhere" commitment. Spring as an open source middleware, independent of the various application servers, and even without the application of server support, but also to provide application server functions, such as declarative transactions, transaction processing and so on. Spring is dedicated to the solutions of each layer of the Java EE application, rather than just focusing on one layer of the solution. It can be said that spring is the "one-stop" choice of enterprise application development, and runs through the performance layer, the business layer and the persistence layer. However, spring does not want to replace those existing frameworks, but rather seamlessly integrate them with them.

(5). In 2006, the launch of the spring2.0;2007 year spring2.5;2008 launched the spring3.0;2011 year launch Spring3.1. Currently, Spring's latest version is Spring4. There are some new features in Spring4, and we can also check the information.





2.Spring software package Download:

(1). For the download of the spring package, we can go to the official website to download, but a lot of English, which has a lot of things, so there is a simple way, next I attach a mirror site: http://maven.springframework.org/ release/org/springframework/spring/, we can download it from here.

(2). You can also download the spring package in this way, we can open this address: Spring's software warehouse address, click on this Http://repo.spring.io URL, as shown in:

Follow the Red arrows above to point at the artifacts after clicking on it, as shown in:


When you open quick Search again, it appears:



After we have entered the search, click the Search button, we can select the spring package we need to download, as shown in:

Here just Spring-framework-4.1.6.release-dist.zip can be selected, next to the download button, download it!

(3). After downloading the above package, unzip the file structure as shown:

Folders include:

Docs folder: This folder contains SPRING4 related documents, development guides, and API reference documents.

Libs folder: This folder contains Spring4 jar packages.

Schema folder: Contains the XSD files used by the Spring4.

Here's how to configure spring, because the jar packages required to configure spring are missing under the Libs directory we downloaded above!





3. Architecture of the Spring framework:

(1). A container is a container in which spring contains and manages the configuration and life cycle of an Application object, and in this sense it is a kind of containers that can configure how each bean is created and how they relate to each other. However, spring should not be confused with traditional heavyweight ejb containers, which are often bulky and cumbersome and difficult to use.

(2). The framework refers to spring's ability to configure and assemble simple components into complex applications. In spring, application objects are combined declaratively, typically in an XML file. Spring also provides many basic functions (transaction management, persistence framework integration, and so on), leaving the development of application logic to developers.

SPRING3 architecture system such as:


(3). Here are some of the important things to follow:

Core container: The core container provides the basic functionality of the spring framework. The main components of the core container are beanfactory and ApplicationContext. The container uses the inversion of control (IOC) pattern to separate the application's configuration and dependency specifications from the actual application code.

Spring Context: The spring context is a configuration file that provides contextual information to the spring framework. The spring context includes enterprise services such as checksum, JNDI, EJB, e-mail, internationalization, and task scheduling.
Spring AOP: With the configuration management feature, the Spring AOP module directly integrates aspect-oriented programming capabilities into the spring framework. Therefore, it is easy to enable any object managed by the spring framework to support AOP. The Spring AOP module provides transaction management services for objects in Spring3-based applications. By using spring AOP, you can integrate declarative transaction management into your application without having to rely on EJB components.
The Spring dao:jdbc DAO Abstraction Layer provides a meaningful exception hierarchy that can be used to manage exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the number of exception codes that need to be written, such as opening and closing connections.
The Spring orm:spring Framework inserts several ORM frameworks, providing ORM tools, including JDO, Hibernate, and Ibatissql Map. All of these conform to spring's common transaction and DAO exception hierarchies.
The Spring web:web context module is built on top of the application context module and provides the context for WEB-based applications. Therefore, the spring framework supports integration with struts. The Web module also simplifies the process of working with multipart requests and binding request parameters to domain objects.
Spring MVC Web framework: The MVC Framework is a full-featured MVC implementation of building Web applications. Through the policy interface, the MVC framework becomes highly configurable. MVC accommodates a large number of view technologies, including JSP, Velocity, Tiles, Itext, and so on.





The function and characteristics of 4.Spring frame: (1). The spring Framework provides a "one-stop-all" service. The spring framework can be used either in Java programming or in Java Web programming, or even in. NET programming. In addition, the spring Framework provides a variety of framework technologies, as well as integration with other framework technologies such as STRUTS2, hibernate, etc.
(2). The spring framework features the following points:
-Easy to decouple and simplify development: through the IOC container provided by spring, the dependencies between objects can be controlled by spring, avoiding the program over-coupling caused by hard coding.
-AOP Programming Support: With the AOP functionality provided by spring, it facilitates aspect-oriented programming, and many of the features that are not easy to implement with OOP (object oriented Programming,oop, OO programming) can be easily implemented with AOP.
-Declarative transaction support: In spring, you can free yourself from tedious transaction management code, and manage the transaction flexibly by declarative means to improve the efficiency and quality of development.
-Easy Program Testing: You can do almost all of the testing with non-container-dependent programming, and in spring, testing is no longer an expensive operation, but something that can be done at your fingertips.
-Easy integration of a variety of excellent frameworks: Spring does not exclude a variety of excellent open source frameworks, instead, spring can reduce the difficulty of using various frameworks, SPRING3 provides direct support for a variety of excellent frameworks (such as Struts2, Hibernate, quartz, etc.).
-Reduce the difficulty of using the Java EE API: Spring provides a thin package layer for many of the hard-to-use Java EE APIs (such as JavaMail, remote invocation, and so on), and the ease of use of these Java EE APIs is greatly reduced through spring's simple encapsulation.
-Framework source code is a classic learning paradigm: Spring's source code design is exquisite, the structure is clear, the originality, everywhere manifests the master to the Java design pattern flexible use as well as in the Java Technology Advanced attainments. The spring framework source code is undoubtedly a best practice example of Java technology. If you want to quickly improve your Java technology and application development level in a short period of time, learning and studying spring source code will make you receive unexpected results.






5. The above content is the basic knowledge of spring framework, because I study in the class is Spring3, so Spring4 new features do not know, we can go to the information, and I mentioned only the spring software package download, and did not say configuration, I will write an article later on how to build the spring environment and write the first spring small program, in my understanding, whether it is Spring3 or Spring4, should be very similar, but Spring4 on the basis of Spring3 added more features, Become more powerful, I have just learned!
Write well, please forgive me, if there are errors, please point out, thank you!





Spring Framework Basics

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.