The way to learn java web -- several exception handling methods in spring boot

Spring Boot (3) error handling 1. User defined exception handling, return to the specified interface In the method of controller error: @RequestMapping("/error") public String error() {     String str=null;     str.length();     return "test"; } In custom error page.html: <!DOCTYPE html> <html xmlns:th="http:// ...

Posted by Adastra on Wed, 06 Nov 2019 08:14:54 -0800

Why is LocalDateTime recommended instead of Date?

Change from: Why is LocalDateTime recommended instead of Date? By reading this article you will learn: Why do I need LocalDate, LocalTime and LocalDateTime How to use java8's new time API, including creation, formatting, parsing, calculation and modification Why LocalDate, LocalTime and LocalDateTime are needed Date if not formatte ...

Posted by imperialized on Wed, 06 Nov 2019 00:51:16 -0800

Spring boot uses redis cache

1. pom import dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </depe ...

Posted by savedlema on Tue, 05 Nov 2019 10:44:31 -0800

I suggest you use LocalDateTime instead of Date

Time processing is often encountered in the process of project development, but do you really use it right? Do you understand that static decoration SimpleDateFormat is disabled in Alibaba development manual By reading this article you will learn: Why do I need LocalDate, LocalTime, LocalDateTime [java8's new class] How to use java8's new ...

Posted by simwiz on Tue, 05 Nov 2019 10:29:45 -0800

Springboot + MySQL + CRUD (add, delete, modify and query)

talk is cheap,show you my codeSource code: springboot-mysql-crud 1. Create a springboot project 2. Import related dependencies <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mave ...

Posted by Chris 96 WS6 on Tue, 05 Nov 2019 08:01:46 -0800

Using Filter in SpringBoot

1. Add filter to traditional web project <filter> <filter-name>TestFilter</filter-name> <!--Definition filter Name and filter class --> <filter-class>com.jiafeng.filter.TestFilter</filter-class> </filter> <filter-mapping> <filter-name>TestFilter</filter-name> <url ...

Posted by therainmaker53 on Mon, 04 Nov 2019 12:14:39 -0800

[from getting started to giving up - Java] concurrent programming - NIO use

Preface Above [from getting started to giving up - SpringBoot] SpringBoot source code analysis - Request Process We learned that tomcat receives and returns requests based on NIO. There are many uses based on NIO in our daily work. We know that NIO can improve the concurrency of the system. In the next series, we will learn about NIO in depth. ...

Posted by Scrank.com on Fri, 01 Nov 2019 06:22:13 -0700

Using SpringBoot+Logback to write a simple link tracking

Catalog I. implementation principle II. Code practice Three, test During the online troubleshooting recently, it was found that too many requests lead to the complexity of the log, and it is impossible to associate the user's logs in one or more requests. Therefore, we used SpringBoot+Logback to wr ...

Posted by mark110384 on Thu, 31 Oct 2019 02:27:25 -0700

[Spring Boot] 07 @PropertySource and @ ImportResource

@PropertySource and @ ImportResource @**PropertySource * *: load the specified configuration file @**ImportResource * *: import the Spring configuration file to make the content in the configuration file effective How SpringBoot recommends adding components to containers: how to recommend usa ...

Posted by mk1200 on Wed, 30 Oct 2019 22:51:46 -0700

Super detailed: summary of six common design patterns

Singleton mode Simply put, in an application, there is only one instance object of a class. You can't go to new because the constructors are decorated by private. Generally, they get their instances through getInstance(). The return value of getInstance () is a reference to an object, not a new instance, so don't misunderstand it as multiple ob ...

Posted by xzilla on Wed, 30 Oct 2019 03:33:22 -0700