1. What is Spring?
We all know the framework, and I'm learning about the three frameworks of Struts2,mybatis and spring.
Struts2 in the presentation layer and business processing
MyBatis processing of business processes and data access
And spring is everywhere.
That's what I understand about spring.
Spring is an open source framework, and spring is a lightweight Java development framework that emerged in 2003 by Rod Johnson in his book expert one-on-one development and Some of the concepts and prototypes elaborated in design are derived. It is created to address the complexities of enterprise application development. One of the main advantages of the framework is its layered architecture, which allows the user to choose which component to use, while providing an integrated framework for Java EE application development. Spring uses basic JavaBean to accomplish things that were previously only possible by EJBS. However, the use of spring is not limited to server-side development. From the standpoint of simplicity, testability, and loose coupling, any Java application can benefit from spring. The core of spring is control inversion (IoC) and facet-oriented (AOP). In short, spring is a layered javase/eefull-stack (one-stop) lightweight open-source framework.
The main content of 2.Spring
Spring
IOC (Control Inversion)/di (Dependency injection)
AOP (plane-oriented programming)
Interception device
Filter filters
Analysis of 3.spring.xml
<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans.xsd ">
<!--
Bean: Corresponds to an object
ID: Similar to object name
Class: Type of Object
-
<bean id= "user" class= "Com.yc.spring.User" >
<!--
Property: Properties of the object
Name: attribute value, corresponding Setxxx method
Value: Property value
-
<property name= "word" value= "yes .... "></property>
<property name= "Age" value= "></property>"
</bean>
Spring is used to control the inversion, in general, we create the object first, then give the value, using the control inversion, when we call the object, before this is already a value
Just need to be in spring. The configuration in XML is possible.
Let's look at a small example of measuring tools
1. We first define a test tool class
Within this, the HEIGHT,WEIGHT,WH three member variables are defined
2. Write three interfaces and interface methods respectively
3. Configure Spring.xml
4. Call the test
Spring Foundation, with a small example to understand it