Home > Java > JavaBase > What are the commonly used frameworks in Java?

What are the commonly used frameworks in Java?

王林
Release: 2019-11-11 15:43:54
Original
8420 people have browsed it

What are the commonly used frameworks in Java?

1. SpringMVC

Spring Web MVC is a lightweight request-driven type based on Java that implements the Web MVC design pattern. The Web framework uses the idea of ​​​​the MVC architectural pattern to decouple the responsibilities of the web layer. Request-driven means using the request-response model. The purpose of the framework is to help us simplify development. Spring Web MVC also wants to simplify our daily Web developing.

The model encapsulates the application data and the POJOs they generally form.

The view (View) is responsible for presenting model data and generally the HTML output it generates, which the client's browser can interpret.

The controller (Controller) is responsible for processing the user's request, establishing the appropriate model, and passing it to the view for rendering.

Spring Web MVC request processing process:

What are the commonly used frameworks in Java?

2, Spring

IOC container

The IOC container is a container with dependency injection function. The IOC container is responsible for instantiating, locating, configuring objects in the application and establishing dependencies between these objects. The application does not need to directly new related objects in the code, the application is assembled by the IOC container. In Spring, BeanFactory is the actual representative of the IOC container.

AOP

Simply put, it is to encapsulate logic or responsibilities that have nothing to do with the business but are commonly called by business modules to reduce duplicate code in the system. , reduce the coupling between modules and facilitate future operability and maintainability. AOP represents a horizontal relationship.

3. Mybatis

MyBatis is an excellent persistence layer framework that supports ordinary SQL queries, stored procedures and advanced mapping. MyBatis eliminates almost all JDBC code and manual setting of parameters and retrieval of result sets. MyBatis uses simple XML or annotations for configuration and original mapping, mapping interfaces and Java POJOs (Plain Old Java Objects, ordinary Java objects) into records in the database.

Overall process:

(1), load configuration and initialize

Trigger condition: load configuration file

Load SQL configuration information into MappedStatement objects (including incoming parameter mapping configuration, executed SQL statements, and result mapping configuration) and store them in memory.

(2), receive the call request

Trigger condition: call the API provided by Mybatis

Incoming parameters: SQL ID and incoming Parameter object

Processing process: Pass the request to the lower request processing layer for processing.

(3), Process the operation request

Trigger condition: API interface layer passes the request

Incoming parameters: SQL ID and Enter the parameter object

Processing process:

(A) Find the corresponding MappedStatement object according to the SQL ID.

(B) Parse the MappedStatement object according to the incoming parameter object to obtain the final SQL to be executed and the execution incoming parameters.

(C) Obtain the database connection, pass in the final SQL statement and execution parameters to the database for execution, and obtain the execution result.

(D) Convert the execution result obtained according to the result mapping configuration in the MappedStatement object, and obtain the final processing result.

(E) Release connection resources.

(4). Return the processing result and return the final processing result

One of the most powerful features of MyBatis is its dynamic statement function. If you have experience using JDBC or similar frameworks before, you will know how painful it is to chain SQL statement conditions together, making sure not to forget spaces or not to omit a comma after columns, etc. Dynamic statements can completely solve these pains.

Recommended tutorial: java tutorial

The above is the detailed content of What are the commonly used frameworks in Java?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template