SpringBoot(二):整合Druid

前言SpringBoot 整合 Druid 实现。实现理论Druid 是一个高性能的开源数据库连接池,它提供了连接池管理、SQL 监控、性能调优等功能。它是由阿里巴巴开源的,旨在提供高效可靠的数据库连接管理解决方案。Druid 连接池具有以下特点和功能:高性能:Druid 使用高效的连接池算法和连接
SpringBoot 2023年07月11日 320次浏览

Java:List处理流操作

前言总结一下 Java 语言中常用的 List 处理流操作。实现过滤元素使用 filter() 方法根据指定的条件过滤列表中的元素。代码:List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);List<Integer> ev
Java 2023年07月10日 372次浏览

Fastjson:JSON格式的字符串转实体对象

背景使用 Fastjson 实现把 JSON 格式的字符串转为实体对象。实现例如有如下字符串:{ "userName": "langjialingbojue", "password": "123456",
Java 2023年07月10日 345次浏览

BigDecimal:计算百分数时保留两位小数

背景使用 BigDecimal 计算百分数时保留两位小数。实现代码:@GetMapping("/t6")public void test6(){ BigDecimal num1 = new BigDecimal("2"); BigDecimal n
Java 2023年07月10日 449次浏览

Mybatis:查询数据提示空指针异常

问题在 SpringBoot 项目中,使用 Mybatis 从数据库中查询数据,查询的数据获取属性时报错空指针异常:java.lang.NullPointerException: null解决例如以下代码段:@GetMapping("/t32")public void test3
BUG 2023年07月10日 357次浏览

JSONObject循环引用异常

背景应用场景是这样的:前端需要构建一个多层 JSON 嵌套的数据结构,而我在使用 fastjson 构建 JSON 结构传给前端后,显示循环引用异常。最终需要构建的 JOSN 结构如下:问题问题复现构建 JSON 的代码如下:@GetMapping("t40")public vo
BUG 2023年07月07日 341次浏览

IDEA报错:Error running 'Application': Command line is too long. Shorten command line

问题使用 IDEA 启动项目时报错信息如下:Error running 'Application': Command line is too long. Shorten command line for Application or also for Spring Boot defa
IDEA 2023年07月07日 508次浏览

Java:计算两个时间的差值

前言使用 Java 计算两个时间的差值。实现package com.langjialing.helloworld.controller;import lombok.extern.slf4j.Slf4j;import org.springframework.web.bind.annotation.Ge
Java 2023年07月06日 348次浏览

Java:常用日期类操作

前言Java 中常用的日期类操作。实现获取前XX时间例如常用的“获取前一年时间”、“获取前一月时间”等操作。package com.langjialing.helloworld.controller;import lombok.extern.slf4j.Slf4j;import org.spring
Java 2023年07月06日 323次浏览

IDEA:自动生成类注释信息

前言在 IDEA 开发中创建新文件时自动生成类注释信息的配置。实现打开 IDEA 的 Settings,依次找到 Editor -> File and Code Templates -> Includes,在 File Header 中添加如下信息:/** * @Author 郎家岭伯爵
IDEA 2023年06月03日 513次浏览