Home > database >  Technical personnel necessary spring know knowledge
Technical personnel necessary spring know knowledge

Time:10-11

(a) spring profile
1. Spring is a one-stop lightweight framework
2. Spring is a non-invasive programming
3 spring also supports three levels of development principles
4. Spring is the most important two components - Aop and the Ioc


The advantage of the Spring framework

Noninvasive design:

Noninvasive refers to minimize dependence on the framework and application code that does not require user code into the framework code information, from the Angle of class of writers, the existence of imperceptibly framework,

Convenient decoupling, simplify the development:

Provided by the Spring IoC container, the dependencies between objects can be controlled by the Spring, to avoid hard coding caused by excessive program coupling, a Spring, users don't have to single instance model classes, properties file parsing code such as these are the underlying demand, can be more focused on the application of the upper,

Support AOP programming:

AOP (Aspect Oriented Programming) Aspect Oriented Programming, Spring provides support for AOP, it allows some common tasks, such as security, transactions, such as log for centralized processing, so as to improve the reusability of the program,


Write the spring is the most important is the configuration file
Write to do is the class to the Spring configuration file management

In the SRC directory applicationContext new Spring core configuration file. The XML

How to write the configuration file?

First of all to write, is the constraint XML configuration files, and the constraints on how to write? As long as to spring - framework - 4.3.20. RELEASE \ docs \ spring - framework - reference \ HTML \ XSD - configuration. The HTML directory to find the relevant constraints is copied to the XML is ok, the only thing left to do is for class configuration,



1 & lt; ? The XML version="1.0" encoding="utf-8"?> 2 & lt; Beans XMLNS="http://www.springframework.org/schema/beans" 3 XMLNS: p="http://www.springframework.org/schema/p" XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi: schemaLocation="6 7 http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans" & gt; 8 and 9 & lt; ! - introduction to Spring's configuration - & gt; 10 & lt; The bean name="user" & gt; 11 & lt; The property name="name" value="https://bbs.csdn.net/topics/li dong"/& gt; 12 & lt; The property name="id" value="https://bbs.csdn.net/topics/1007"/& gt; 13 & lt;/bean> 14 15 & lt;/beans>


The IOC and DI description

IOC (Inversion Of Control) : Inversion Of Control, this is a kind Of design thought, is originally in the program manual Control Of creating an object, by the Spring framework to manage,

DI (Dependency Injection) : Dependency Injection, the object Dependency property (simple values, collection, object) set values for the object through configuration,

Note: #

The above example, the application of the IOC and DI is not the same thing,


CodePudding user response:

Thanks for sharing, notes suggest to personal blog
  • Related