springMVC execution process and working principle

SpringMVC execution process: 1. The user sends a request to the front-end controller DispatcherServlet 2. DispatcherServlet receives the request and calls the processor mapper HandlerMapping. 3. The processor mapper finds the specific processor according to the request URL, generates the processor execution chain HandlerExecutionChain (including the processor object and processor interceptor) and returns it to […]

SpringMVC02- View resolver and controller

Environmental description JDK 17 SpringMVC 6.0.6 Tomcat 10.0.12 Thymeleaf 3.1.2.RELEASE Environment preparation Add SpringMVC dependency and Thymeleaf dependency: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.0.6</version> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring6</artifactId> <version>3.1.2.RELEASE</version> </dependency> Configuring view resolvers and controllers Configure the view resolver and register the corresponding ViewResolver as a Bean (Thymeleaf template view resolver configuration steps: template resolver -> template […]

SpringMVC–@RequestMapping annotation

@RequestMapping annotation The function of @RequestMapping annotation The location of the @RequestMapping annotation @RequestMapping annotated properties 1. value attribute 2. method attribute 3. params attribute (understand) Replenish @RequestParam @RequestHeader @RequestBody @RequestBody gets request parameters in json format @ResponseBody @RestController annotation Function of @RequestMapping annotation The function of the @RequestMapping annotation is to associate the request […]

The evolution of Java Web technology: from Servlet, SpringMVC to WebFlux

The evolution of Java Web technology: from Servlet, SpringMVC to WebFlux Preface With the rapid development of Internet technology, Web applications face huge challenges when handling massive user access and big data. In this process, Java Web development technology has experienced an evolution from Servlet to Spring MVC to WebFlux. In this article, we will […]

SpringMVC source code: Initialization of DispatcherServlet (3)

In the previous part, FrameworkServlet left onRefresh to DispatcherServlet to complete, So go into DispatcherServlet # onRefresh Refresh the Spring container (the sub-container is refreshed here) @Override protected void onRefresh(ApplicationContext context) {<!– –> initStrategies(context); //The parameter context here is the SpringWeb container created before (and later passed as a parameter to the initialization function of […]

Series 35, Spring + SpringMVC + MyBatis integration

1. Overview Integrate Spring, SpringMVC, MyBatis. 2. Integration steps 2.1, pom <dependencies> <!– Use Sl4j annotations in ordinary maven projects –> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.22</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.32</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.2.10</version> </dependency> <!– Tools –> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.76</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>4.3</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.11</version> </dependency> <dependency> […]

Customize SpringMVC interceptor to implement internal and external network access control functions

This article briefly introduces how to customize a SpringMVC interceptor and implement specific functions through the interceptor. First, you need to create a custom interceptor class that implements the HandlerInterceptor interface. package cn.edu.sgu.www.mhxysy.interceptor; import cn.edu.sgu.www.mhxysy.feign.FeignService; import cn.edu.sgu.www.mhxysy.property.NetworkProperties; import cn.edu.sgu.www.mhxysy.restful.JsonResult; import cn.edu.sgu.www.mhxysy.restful.ResponseCode; import cn.edu.sgu.www.mhxysy.util.IpUtils; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; […]

[SpringMVC] 5 types of parameter transfer &&json data parameter transfer

Column【SpringMVC】 Favorite verse: Heaven moves vigorously, and a gentleman strives to constantly strive for self-improvement. Music Sharing【As You Wish】 Welcome and thank everyone for pointing out Xiaoji’s problem Article directory Common parameters POJO parameters Nested pojo parameters Array parameters Collection parameters json data parameter transfer json format Nested json format Collection format In Web project […]

spring, springMVC, mybatis annotations

SSM annotations 1. Mybatis annotations @Param: used to pass parameters so that they can correspond to field names in SQL @Insert: Implement new addition, instead of @Delete: Implement deletion instead of @Update: Implement updates instead of @Select: implements query instead of @Result: Implement result set encapsulation instead of @Results: Can be used together with @Result […]

SpringMVC

Table of Contents 1. Learn Spring MVC 1.1 Learning questions 1.2 Create MVC project 2. Realize the “connection” between the client and the program 2.1 @RequestMapping 2.2 @GetMapping and @PostMapping 3. Get parameters 3.1 Get a single parameter 3.2 Get multiple parameters 3.3 Passing objects 3.4 Passing parameters from a single table 3.5 Backend parameter […]