About Spring Getting Started

Source: Internet
Author: User


Spring Overview

Introduction to Spring

Spring is a lightweight control inversion and aspect-oriented container framework that was created primarily to address the complexities of enterprise application development:

Objective: To solve the complexity of enterprise application development

Function: Use basic JavaBean instead of EJB

Scope: Any Java application

The origins of Spring

Spring exists because it has a unique advantage:

1, it is located in the field of many other popular framework does not have

2. Spring is comprehensive and modular

3. It's designed from the bottom to help you write code that is easy to test

4. Spring is a potential and one-stop solution

The advantages of Spring

Advantages of Spring:

1, low-intrusive design, code pollution is very low

2. Write Once, Run anywhere

3, Di effectively reduce the coupling degree

4. AOP provides centralized management of common tasks

5. ORM and DAO simplifies database access

6. High degree of openness, not mandatory

benefits of Spring's benefits:

1, can effectively organize middle-tier objects

2. Use a unified configuration file

3. Promote good programming habits and reduce the cost of programming

4. Easy Unit Testing

5. Make EJB an alternative

6. Provide a consistent framework for data access

Features of Spring

1, easy to decouple, simplify the development

2, AOP programming support

3. Declarative transaction support

4. Convenient program Testing

5, convenient integration of a variety of excellent framework

6, reduce the use of Java EE API difficult

7, Spring source code is a classic learning paradigm

The basic framework of spring

1. Core Container Spring Core

2. Application Context Spring contexts

3. AOP Module Spring AOP

4. JDBC and DAO modules

5. Object Entity Mapping Spring ORM

6. Web Module Spring Web

7. MVC Module Spring Web MVC

Summary of Spring  

1. Spring brings complex Java EE programming

2, its core is the lightweight IOC container, its goal is to provide a full range of Java EE Integration Framework, in the spring framework to implement a multi-sub-framework, the sub-frameworks are independent of each other, you can also use other framework schemes to replace them

3. Spring wants to provide one-stop solution for enterprise application


Spring's IOC

On IOC

IOC is the core of spring, throughout. The so-called IOC, for the spring framework, is the responsibility of spring to control the life cycle of objects and the relationships between objects:

1. Traditional development mode: mutual dependence between objects

2, IOC development mode: IOC container to arrange the dependencies between objects

DI Dependency Injection

another name for the IOC is called Dependency Injection, which is the dynamic injection of a dependency into an object by the IOC container while it is running, so that dependency injection and control inversion are the same thing that is described from different angles, that is, by introducing an IOC container, The decoupling between objects is realized by the method of dependency injection .

The benefits of the IOC

The IOC does not have a strong intrusion into business objects during the programming process, and after using IOC, the object is more accessible, reusable, and extensible:

1, reduce the coupling between components

2, improve the development efficiency and product quality

3, unified standards, and improve the reuse of modules

4, the module has hot-swappable characteristics

The popular understanding of the IOC

IOC control inversion: It is said that the control of creating an object instance is stripped from the code control to the IOC container control, which is actually what you control in the XML file, focusing on the principle

Di Dependency Injection: When an object instance is created, an attribute value or other object instance is injected for the object, focusing on implementing

Spring's AOP

What is AOP

Basic concepts of AOP

The relationship between AOP and OOP

Main features of AOP

The main intent of AOP

The existence value of AOP

AOP is designed to deal with cross-focus issues that are distributed across modules in the system, and AOP is often used to handle system-level services with crosscutting properties, such as transaction processing, security checks, caching, object pool management, and so on, which has become a very common solution for Java EE applications.

An analysis of the principle of AOP

an AOP proxy is actually an object that is dynamically generated by the AOP framework, which can be used as a target object. The methods and target objects that the AOP proxy contains are as follows:

Method of proxy object = Enhanced processing + method of proxied Object


Key concepts of AOP

Slice Aspect

Connection points Join point

Notify advice

Pointcut Point Cut

Introduction of introduction

Destination Object Target Objects

AOP Agent AOP Proxy

Woven into the Weaving

The popular understanding of AOP

A component A, does not care about other commonly used component service B, but this component a uses component B when it is not called by component a itself, but through configuration, etc., such as the XML configuration file can be used in spring. This makes a no need to know what service component B is, a only care about their business logic, specific a when using B, the configuration file to do, and the specific a build does not matter.





About Spring Getting Started

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.