What can struts and hibernate do?
Struts
Solution for control layer in MVC
Request data can be automatically encapsulated, type conversion, file upload, validation ...
Hibernate
solutions for durable layers;
Can do,
Save the object to the database,
The object is taken from the database.
Spring Framework
Project development based on the MVC model of struts and hibernate;
Thinking:
1. Object creation can I write to death?
2. Object creation Details
Number of objects
Action multiple "maintain member variables"
Service One "does not need to maintain public variables"
DAO one "does not need to maintain public variables"
Creation time
Action Access time created
Service startup time created
DAO starts when you create
3. Object dependencies
Action Dependent Service
Service Dependent DAO
Summarize:
Spring is the solution to the above problem! In simple terms, it is the process of creating objects and the dependencies of objects!
Components/ Frame Design
Intrusive design
Introduces a framework that affects the structure of existing classes, that is, the need to implement or inherit some particular class.
Example: Struts framework
Non-intrusive design
The framework is introduced and has no effect on the existing class structure.
Example: Hibernate frame/Spring frame
Control inversion:
Inversion on control, reversing IOC
The creation of the object is given to the outer container, which is called inversion of control.
Dependency Injection, Dependency injection
Working with objects ' dependencies
Difference:
Control reversal, solve object creation problem "object creation to others"
Dependency Injection, (expansion)
After the object is created, the processing of the object's relationship is dependent injection "through set method dependency Injection"
Aop
plane-oriented programming. Facets, simply speaking, can be understood as a class, a class that is formed by a lot of repeating code.
Section Examples: Transactions, logs, permissions;
The Spring framework resolves a framework for object creation and dependency relationships between objects.
And can be used with other frameworks; Spring and struts, spring and hibernate
(A framework for the integration (bonding) function)
Spring provides a one-stop solution:
1) core features of Spring Core spring: IOC container, resolving object creation and dependencies
2) Spring Web Spring support for Web modules.
Can be integrated with struts, allowing struts action to be created to spring
Spring MVC pattern
3) Spring DAO Spring support for JDBC Operations "jdbctemplate Template Tool Class"
4) Spring ORM Spring support for ORM:
Can be integrated with Hibernate, "session"
You can also use spring's encapsulation of hibernate operations
5) Spring AOP slicing programming
6) Springee Spring support for other Java EE modules
Spring Framework Introduction