SpringBoot(四):整合Thymeleaf

前言SpringBoot 整合 Thymeleaf。实现理论Thymeleaf 是一个优秀的、面向 Java 的 HTML 页面模板,具有丰富的标签语言和函数。在 JSP 被淘汰之后,Thymeleaf 取而代之成为了 Spring Boot 推荐的模板引擎。Thymeleaf 在有网和没网的环境下
SpringBoot 2023年07月14日 493次浏览

SpringBoot(三):整合JPA

前言SpringBoot 整合 JPA。实现理论Spring Data 是 Spring 提供的一个操作数据的框架,Spring Data JPA 是 Spring Data 下的一个基于 JPA 标准的操作数据的模块。JPA(Java Persistence API) 是 Java 母公司 Sun
SpringBoot 2023年07月12日 495次浏览

SpringBoot(二):整合Druid

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

Java:List处理流操作

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

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

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

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

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

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

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

JSONObject循环引用异常

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

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日 752次浏览

Java:计算两个时间的差值

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