@ Talk about the execution process of SPRINGMVC @
When the system starts, it creates a spring container based on the configuration file, first sending an HTTP request to the core controller dispatherservlet,spring container through the mapper to find the business controller,
using the adapter to locate the appropriate business class, In the business class when the data encapsulation, before encapsulation may involve type conversion, after the execution of the business class using Modelandview for view forwarding, data in the model, the map to pass the data for the page display
Spring is a lightweight, one-stop framework for open source
1, open-source
2. Lightweight
3, one-stop
[plain] view plain copy spring in the Java EE three layer structure, each layer provides a different solution technology (1) Web tier: SPRINGMVC (2) service layer: Spring's IOC (3) DAO Layer: s Pring's JdbcTemplate
Spring's IOC and DI operations IOC: Control inversion--the underlying technology {XML config file, dom4j parsing XML, factory design pattern, reflection}
1, the creation of the object to spring for management
2, IOC operation two ways:
(1) IOC configuration file mode (master)
Instantiation of the Bean (three ways)
① Non-parametric construction method instantiation (emphasis)
[HTML] view plain copy <bean id= "user" class= "com.yb.User" ></bean> [HTML] view Plain CO PY Bean Tags Common properties: id attribute: Gets the configuration object based on the ID value, cannot contain special characters. Class attribute: Creates the full path of the class in which it resides. The Name property: Functions and IDs, but can contain special characters. Scope Property: (Singleton: Default value (the default), Singleton prototype: Multiple request: Create an object put the object in the Request field session: Create Object object is placed inside the session field Globalsession: Create object put object in Globalsession)
② using static factory creation (Learn)
③ creating with Instance factory (learn)
(2) IOC annotation method Injection (emphasis)
[HTML] view plain copy <!--Scan properties above annotations (superseded by the following scan mode)-<context:annotation-config></context:an Notation-config> <!--to package inside Scan: Class, method, properties above comments-<!--to scan com.yb.entity, Com.yb.dao ... The annotations inside can be written as com.yb--> <context:component-scan base-package= "Com.yb" ></context:component-scan> Use annotation implementations above the class that created the object
① @Component derived from the following three annotation usages of the same
② @Controller: Web Tier
③ @Service: Business layer
④ @Repository Persistence Layer
[Java] view plain copy @Component (value= "User") public class User {}
Create a multi-instance or single-instance object