Spring's face question

Source: Internet
Author: User

Spring face question One

Directory
First, spring working principle
Second, why use spring
Three, please talk about SSH integration
Iv. Introduction to Spring's transaction management
V. What is dependency injection and what is the role of dependency injection?
Vi. What is the role of AOP,AOP?
What are the roles of Beanfactory and ApplicationContext in spring?
Eight, Connection pool
Ix. Cross-Library transactions


I. How Spring MVC Works
1. Client request submitted to Dispatcherservlet
2. Query one or more handlermapping by the Dispatcherservlet controller to find the controller that handles the request
3. Dispatcherservlet submits the request to the controller
4. After the controller invokes the business logic processing, returns the Modelandview
5. Dispatcherservlet query One or more Viewresoler view resolvers to find the Modelandview specified view
6. The view is responsible for displaying the results to the client

second, why use spring
1, spring can be very good integration with the major framework
2, when creating objects, if we do not need to use the Spring Factory mode to create, this spring equivalent to the factory model has helped us to create the object of the function (IOC, Dependency injection).
3. When using hibernate, if you don't have to write the commit code of the transaction every time, spring can help us manage the transaction through AOP.
4, Aspect-oriented programming (AOP) when you want to record a log, you need to add a record in the data to add a successful or failed record, then you can use the spring AOP to deal with, although no AOP can do but without the spring AOP will write a lot of duplicate code.

Three, please talk about SSH integration
Ssh:struts (presentation layer) +hibernate (persistence layer) +spring (business layer)

A, Struts
Struts is a presentation-layer framework that mainly functions as interface display, receiving requests, and distributing requests.
B, Hibernate
Hibernate is a persistent layer framework that is only responsible for operations with relational databases.
C, Spring
Spring is a business-layer framework that is an integrated framework that is well-bonded to the presentation and persistence layers.

Iv. Introduction to Spring's transaction management
A transaction is a uniform commit or rollback operation for a series of database operations (such as inserting multiple data), and if the insert succeeds, it succeeds, and if there is an exception in the middle, all actions before the rollback. This prevents dirty data from occurring and prevents problems with database data.

In development, transaction management is generally done to avoid this situation. Spring also has its own transaction management mechanism, typically managed using Transactionmananger, which can be done through spring injection.

v. What is dependency injection and what is the role of dependency injection?
IOC is an idea that can guide us in designing loosely coupled, better programs. Traditional applications are created by us to create dependent objects within the class, which causes the class to be highly coupled to the class and difficult to test; with the IOC container, the control of creating and finding dependent objects is given to the container, which is injected by the container, so that the object is loosely coupled with the object, so it is also easy to test. Facilitates functional reuse and, more importantly, makes the entire architecture of the program very flexible.

The role of dependency injection: reduce inter-class coupling and avoid creating objects with new

Vi. What is the role of AOP,AOP?
AOP, aspect-oriented programming, is to extract reusable functionality, and then weave these common functions into the application at the right time, such as transaction management, permissions control, logging, performance statistics, and so on.

The role of AOP
AOP does not help us solve any new problems, it just provides a better way to solve existing problems with less effort, making the system more robust and more maintainable.

What are the roles of Beanfactory and ApplicationContext in spring?
1. Beanfactory is responsible for reading the bean's configuration file, managing the bean's loading, instantiating, maintaining the dependency between the beans, and responsible for the bean's life cycle.
2, ApplicationContext In addition to providing the functions provided by the above Beanfactory, but also provides a more complete framework functions:
A. Internationalization support
B. Resource access
C. Event Delivery

Eight, Connection pool
C3P0, DBCP

Ix. Cross-Library transactions
Atomikos, Jotm

Spring's face question

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.