Spring summary (1) Introduction to Spring

What is Spring?

The spring often mentioned by programmers is actually called Spring Application Framwork, which is a very popular web application framework.

What are the characteristics of Spring?

The core idea of ​​Spring can be described in one sentence-"dependency injection, inversion of control". You can think of it as a container, in which large and small instances of the manager application. If you need an instance of a certain class, you can get it directly through the ApplicationContext. The function of Spring determines the role it can play. Because Spring maintains the dependency between instances, it decouples the program to a large extent and provides convenience for interface-oriented programming. Taking web projects as an example, as we all know, web projects are usually divided into three times, from top to bottom, they are Contrller layer, Service layer, and Dao layer. The relationship between the upper layer and the lower layer is maintained by Spring. When the implementation of the lower layer changes, you only need to inject a new instance into the Spring container, and the upper layer does not need to modify it.

How to use Spring?

There are three core packages of the Spring framework, spring-context, spring-core, and spring-bean packages. Just add relevant dependencies in the maven pom file.

 

 

Guess you like

Origin blog.csdn.net/qq_28411869/article/details/85279446