Integrated use of filters, interceptors and listeners in springboot

controller layer For testing @RestController public class TestController { @GetMapping("/addSession") public String addSession(HttpServletRequest request) { HttpSession session = request.getSession(); session.setAttribute("name", "dalaoyang"); return "Number of people currently online" + MyHttpSessionListe ...

Posted by whiteboikyle on Fri, 29 Oct 2021 04:40:37 +0200

How to realize 485 communication through Java

1. Selection of overall architecture First of all, according to the requirements, I use the springboot+netty architecture, using a serial port to network port conversion module. Why use it like this? The Linux system is used during deployment. It is troublesome to install the driver under Linux, so the network port can save a lot of server con ...

Posted by fipp on Fri, 29 Oct 2021 04:34:47 +0200

Introduction to Mybatis from novice village to fighting low-level wild monsters

Course objectives Build MyBatis development environmentComplete the operations of adding, deleting, modifying and querying a single table based on annotationsComplete the operations of adding, deleting, modifying and querying multiple tables based on annotationsComplete the operations of adding, deleting, modifying and querying a single table ...

Posted by Ne0_Dev on Thu, 28 Oct 2021 15:00:34 +0200

SpringBoot learning note 06 request mapping for Web development

Learn from: Shang Silicon Valley Use of Rest requests Change of access method The original access is to write get, post, delete and put separately, and the Rest request combines them to some extent. Previous: / getUser get user / deleteUser delete user / editUser modify user / saveUser save user Now: / user - > (get delete put post) Impl ...

Posted by colesw on Thu, 28 Oct 2021 13:52:14 +0200

Security integration JWT part 09

function Integrate JWT into the project, which is divided into two stages 1. Log in for authentication for the first time. If the authentication is successful, a token will be returned 2. Subsequent requests carry a token for authorization authentication, that is, they need to be re authenticated before each authorization 1 github: Sourc ...

Posted by flamtech on Thu, 28 Oct 2021 12:23:43 +0200

SpringBoot integrates Redis to implement caching (automatic caching + manual aop caching)

demo address: https://gitee.com/pdh_gitee/redis-cache-demo.git. Redis must be available locally, which is the premise. All demo s are tested on windows. In the spring boot project, you can usually use the automatic cache policy, or you can use the RedisTemplate class to operate redis, and redis can be configured (of course, this is trou ...

Posted by kslagdive on Thu, 28 Oct 2021 08:53:09 +0200

Detailed explanation of SpringBoot&Filter

Detailed explanation of springboot & filter In fact, the filter is to intercept web resources, and then hand them over to the next filter or servlet for processing. It is usually used to intercept request s for processing, or to intercept the returned response The general flow chart is as follows Application scenario automatic logon ...

Posted by surion on Thu, 28 Oct 2021 08:07:22 +0200

Use MongoDB in SpringBoot to add, delete, modify and query based on MongoRepository (basic section)

1, MongoDB configuration 1. Import jar package <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> 2. Configuration of mongodb basic scanning package 1.In the configuration file bootstrap.properties Add driver to spring.data. ...

Posted by cybercrypt13 on Wed, 27 Oct 2021 13:48:29 +0200

Spring nested transaction rollback

catalogue Spring nested transaction rollback Problem description Project background: Problem recurrence 1. Declaration transaction of spring 2. Event processing logic of transaction 3. Actual business Service layer method 4.Druid data source configuration 5. Test execution Log analysis Analyze the cause of the problem summary Trans ...

Posted by Adam on Wed, 27 Oct 2021 09:15:38 +0200

SpringBoot: how to gracefully pass parameters, encapsulate response data, and handle exceptions?

In project development, JSON format is used for data transmission between interfaces and between front and back ends. 1 fastjson usage Alibaba's fastjson is currently the most widely used JSON parsing framework. This article will also use fastjson. 1.1 introducing dependencies <dependency> <groupId>com.alibaba</groupId&gt ...

Posted by Deadman2 on Mon, 25 Oct 2021 15:00:37 +0200