springboot+ seata+nacos **1、**在 Seata Release 下载最新版的 Seata Server 并解压得到如下目录:.├──bin├──conf├──file_store└──lib2、 修改 conf/registry.conf 配置,目前seata支持如下的file、nacos 、apollo、zk、consul的注册中心和配置中心。这里我们以nacos 为例。将 type 改为 nacosregistry { # file 、nacos 、eureka、redis、zk、consul、e
Redisson分布式锁简单使用 import org.redisson.Redisson;import org.redisson.api.RLock;import org.redisson.api.RedissonClient;import org.redisson.config.Config;import org.springframework.stereotype.Component;import java.util.concurrent.TimeUnit;@Componentpublic class RedisL.
java TXT文件编码转UTF-8 package com.syqm.greatpan.gateway.controller.multimedia;import java.io.*;import java.net.HttpURLConnection;import java.net.URL;/** * <Detect encoding .> * Copyright (C) <2009> <Fluck,ACC http://androidos.cc/dev> * * This
List对象处理 1.// 根据position去重// 根据position去重 return responseDTOList.stream().collect( Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(xxxxxxxxxxx::getXxxxxxx))), A
雪花算法实现优化系统时钟回退 1.工具类/** * 使用雪花算法生成全局id */@Log4j2@Componentpublic class SnowflakeIdUtils { private SnowflakeIdWorker idWorker; @PostConstruct public void init() { Random rd = new Random(); //工作id,数据中心ID long workerId = r
mysql创建分区表 1.按天分区CREATE TABLE 表名xxxxxxxxx (id BIGINT ( 20 ) NOT NULL AUTO_INCREMENT COMMENT ‘id’,create_time date NOT NULL COMMENT ‘创建时间’,PRIMARY KEY ( id,create_time)) ENGINE = INNODB AUTO_INCREMENT = 29 DEFAULT CHARSET = utf8mb4 COMMENT = ‘表说明xxxxxxxx’PARTITI
表创建时自动创建时间和更新时间 表创建时自动创建时间和更新时间 `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间,即数据首次同步的时间', `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '触发唯一约束时记录更新时间',...
linux环境下发送post请求 curl curl --location --request POST '填写url' \--header 'xxxx: xxxxxxxxxxxxx' \--header 'Content-Type: application/json' \--data 'JSON格式'
linux下常用查看日志命令 1.查询日志尾部最后100行的日志,并且随文件tail -fn100 catalina.log2.查询日志文件中的头10行日志head -n100 catalina.log3.清空屏幕ctrl+l 或者 clear4.按照关键字查找日志 (知道程序出问题的模块,而且有日志关键字的可以用此方法)<1>.找到发错错误异常的行号比如我们日志中关键字error表示错误grep "error" -n access.log或者cat -n catalina.log |gre
使用lombok后项目启动报警告 在实体类下添加 lombok.config 文件,文件内容为下列内容config.stopBubbling=truelombok.equalsAndHashCode.callSuper=call
校验不通过 抛出异常 1.无效状态异常。 一般来说无效状态异常是因为你弄错了调用一个方法的流程if (count < 1) { throw new IllegalStateException("提交失败,数据状态不一致"); }2.不合法的参数异常Preconditions.checkArgument(isValidDate(startTm) && isValidDate(endTm), "日期格式不正确。");...
java中元素、数组转换成List集合 如何将一个元素优雅的转换成一个集合 @Test public void testArraysList() { String[] array = {"a","b","c"};// List<String> strings = Arrays.asList(s);// ArrayList<String> string...
使用easyExcel导出excel报错Failed to read zip entry source poi导出报IOException异常,错误提示Failed to read zip entry source问题:poi读取excel模板配置,按模板格式导出excel,读取excel模板时,报以上错误。KaTeX parse error: Undefined control sequence: \classes at position 59: …缩时出问题,可以去target\̲c̲l̲a...
mysql设置密码报错:mysqladmin: connect to server at 'localhost' failed的解决方法 起因:安装完mysql后,启动mysql服务,接下来为mysql设置用户root的密码,结果报错D:\developSoftware\mysql\mysql-5.6.17-winx64\bin>mysqladmin -u root -p passwordEnter password: ******mysqladmin: connect to server at 'localhost' ...
使用easyExcel读取模版时 报 java.io.FileNotFoundException: does not exist 在开发时使用easyExcel读取模版时 报 java.io.FileNotFoundException: does not exist原代码String templateFileName = this.getClass().getClassLoader().getResource("template.xlsx").getPath();改后代码InputStream inputStrea...
JAVA中serialVersionUID = 1L serialVersionUID作用:序列化时为了保持版本的兼容性,即在版本升级时反序列化仍保持对象的唯一性。有两种生成方式:一个是默认的1L,比如:private static final long serialVersionUID = 1L;一个是根据类名、接口名、成员方法及属性等来生成一个64位的哈希字段,比如:private static final long ser...