摘要:
1.spring-kafka <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> <version>1.3.5.RELEASE</version></depen 阅读全文
摘要:
import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamRea 阅读全文
摘要:
项目有时为了方便配置数据字典,会创建类似于“test=测试” 的key-value形式的数据字典,在项目启动时便缓存该字典数据,方便后续使用;但是该字典有时候又存在中文,在加载之后会出现乱码问题,便需要对加载的数据进行特殊处理。 public class ConfigUtils { /** * 加载 阅读全文
摘要:
/** * 获取 文件 流 * * @param targetPicUrl 网络图片url * @return * @throws IOException */ private InputStream getFile(String targetPicUrl) { InputStream inStre 阅读全文
摘要:
1. 图片中存在中文时,可能会造成无法正确获取网络图片的问题,便需要进行转码。 String picNameUrlEncode = URLEncoder.encode(pictureUrl, "UTF-8"); 2. 具体实现 /** * 将网络图片编码为base64 * * @param url 阅读全文
摘要:
(1)带时区的时间类型 2021-12-16T14:05:09.202+08:00 转换成常用的年月日时分秒 2021-12-16 14:05:09 String oldDateStr = "2021-12-16T14:05:09.202+08:00"; try{ if(!oldDateStr.co 阅读全文
摘要:
(1)时间类型比较,需要添加关键字 timestamp select * from track where create_time > timestamp '2021-08-17 11:41:09'; (2)主键自增 A. 建表时采用 SERIAL 关键字 create table tes_user 阅读全文
摘要:
启动时自动运行: (1)实现CommandLineRunner接口; (2)重写run()方法 import lombok.extern.slf4j.Slf4j; import org.springframework.boot.CommandLineRunner; import org.spring 阅读全文
摘要:
AbstractQuenedSynchronizer抽象的队列式同步器。是除了java自带的synchronized关键字之外的锁机制。AQS的全称为(AbstractQueuedSynchronizer),这个抽象类在java.util.concurrent.locks包。 核心思想(AQS=st 阅读全文