jvm内存分析工具mat分析jvm快照 -- hprof文件
摘要:mat工具下载地址: https://www.eclipse.org/mat/downloads.php end.
阅读全文
posted @
2023-01-19 15:17
梦幻朵颜
阅读(367)
推荐(0) 编辑
SpringWebflux框架里导出excel文档
摘要:本demo里使用springboot 2.7.0版本。 @GetMapping("/download/excel/file") public Mono<Void> downloadExcelFile(ServerHttpResponse response, WebSession webSession
阅读全文
posted @
2022-08-19 17:39
梦幻朵颜
阅读(879)
推荐(0) 编辑
java字符串固定长度,左补空格,或右补空格
摘要:String a = String.format("%5s", "abc");log.info("a=[{}]", a); 打印:a=[ abc] String b = String.format("%-5s", "abc");log.info("b=[{}]", b); 打印:b=[abc ]
阅读全文
posted @
2022-06-26 18:03
梦幻朵颜
阅读(3608)
推荐(1) 编辑
Java8中使用java.time.temporal.ChronoUnit辅助类计算两个ZonedDateTime日期对象的间隔月、间隔天数、间隔小时、间隔分钟数
摘要:直接贴代码: import java.time.temporal.ChronoUnit; @Test public void test计算两个ZonedDateTime日期的间隔时间() { ZonedDateTime start = ZonedDateTime.of(2022,3,27,10,0,
阅读全文
posted @
2022-03-27 12:53
梦幻朵颜
阅读(802)
推荐(0) 编辑
时间复杂度计算法
摘要:for (int i=0; i<3; i++){ for (int j=0; j<3; j++){ for (int k=0; k<3; k++){ // to do something } } } 这个过程是一个嵌套循环,时间复杂度是 O(i*j*k),i j k 都是3,所以时间复杂度是O(27
阅读全文
posted @
2021-07-04 06:28
梦幻朵颜
阅读(133)
推荐(0) 编辑
为SqlServer数据库生成Java可用的SSL加密JKS证书
摘要:当SqlServer DB需要 Java 使用 SSL 加密连接时,I can help you by this article. SqlServer 有多台比如多主多从模式时,需要拿到数据库的 cer 证书,并根据这些 master slave SqlServer DB 的 cer 证书生成 Ja
阅读全文
posted @
2021-04-29 16:54
梦幻朵颜
阅读(724)
推荐(0) 编辑
RSA 算法私钥公钥生成和导入秘钥库步骤,加签名和验签 Java 代码
摘要:1)RSA私钥和公钥生成步骤 步骤一,生成JKS文件ecouponNotificationRsa.jks,别名为:ecoupon_notification_key,期限20年,jks证书密码123456,算法是RSA keytool -genkeypair -keyalg RSA -keysize
阅读全文
posted @
2021-04-29 15:59
梦幻朵颜
阅读(1162)
推荐(0) 编辑
HttpClient模拟x-www-form-urlencoded格式的form表单提交
摘要:form表单提交的时候,是x-www-form-urlencoded 格式,此时如果用HttpClient类去做,代码应该是这样: import com.gewara.util.HttpResult;import org.apache.http.NameValuePair;import org.ap
阅读全文
posted @
2020-09-08 11:38
梦幻朵颜
阅读(4550)
推荐(0) 编辑
springboot针对controller层返回对象设置全局返回json格式
摘要:直接贴代码: import com.disney.wdpro.service.ecoupon.redemption.service.controller.interceptor.HttpStatusInterceptor; import com.disney.wdpro.service.ecoupo
阅读全文
posted @
2020-09-08 10:55
梦幻朵颜
阅读(2907)
推荐(0) 编辑
postman中设置全局动态sign签名脚本
摘要:进入某个collection的全局edit设置: 在"Pre-request Scripts"选项卡设置全局脚本: 全局脚本贴上代码: function getCurrentDate() { var myDate=new Date(); // 获取当前时间戳 var year = myDate.ge
阅读全文
posted @
2020-08-28 10:56
梦幻朵颜
阅读(2013)
推荐(0) 编辑
controller层返回实体类中自动过滤非空字段到前端
摘要:在类上加注解: @JsonInclude(value = JsonInclude.Include.NON_NULL)
阅读全文
posted @
2020-08-27 15:09
梦幻朵颜
阅读(844)
推荐(0) 编辑
com.fasterxml.jackson包序列化json对象和反序列化
摘要:需要序列化的类需实现接口: public class ResponseModel implements Serializable { 序列化和反序列化代码例子: import com.fasterxml.jackson.annotation.JsonInclude; import com.faste
阅读全文
posted @
2020-07-19 11:59
梦幻朵颜
阅读(4105)
推荐(0) 编辑
SpringSecurity3.2.10 + SpringBoot2.1.11 + ConcurrentSession(分布式会话)+ redis
摘要:注意:SpringBoot2.1.11 应该搭配更高版本的SpringSecurity. 1、引入maven依赖 本项目中用的SpringBoot2.1.11,引入自带的 spring-boot-starter-security 版本为 5.1.7,但是由于是老项目需要兼容旧版本,所以使用了低版本的
阅读全文
posted @
2020-07-12 09:16
梦幻朵颜
阅读(424)
推荐(0) 编辑
java对象转byte[]数组,byte[] 数组转java对象,demo
摘要:demo: /** * 对象转字节数组 */ public static byte[] objectToBytes(Object obj) throws IOException { try( ByteArrayOutputStream out = new ByteArrayOutputStream(
阅读全文
posted @
2020-07-11 09:49
梦幻朵颜
阅读(8865)
推荐(0) 编辑
Java8里的HashMap对象lambda遍历方法
摘要:Java demo: Map<String, User> map = new HashMap<>(); map.put("id1", new User(1,"name1")); map.put("id2", new User(2,"name2")); String str = map.entrySe
阅读全文
posted @
2020-06-30 11:40
梦幻朵颜
阅读(3270)
推荐(0) 编辑
Jdk8最全日期转换类,String转各种日期,各种日期转String
摘要:java有自带的日期格式化类,并且定义了各种日期格式常量:DateTimeFormatter.ISO_OFFSET_DATE_TIME 2011-12-03DateTimeFormatter.ISO_DATE 2011-12-03DateTimeFormatter.ISO_LOCAL_DATE 20
阅读全文
posted @
2020-04-13 19:22
梦幻朵颜
阅读(13554)
推荐(0) 编辑
SpringBoot传参设置全局Timestamp和Date日期转换类
摘要:我的另一篇日期实用博文《Jdk8最全日期转换类,String转各种日期,各种日期转String》 1、设置全局String转换到Timestamp转换类 import org.apache.commons.lang.StringUtils; import org.springframework.co
阅读全文
posted @
2020-04-13 17:59
梦幻朵颜
阅读(4820)
推荐(0) 编辑
Springbatch各版本的各个功能点官方教程 https://docs.spring.io/spring-batch/docs
摘要:Springboot各版本的各个功能点官方教程地址: https://docs.spring.io/spring-batch/docs 然后根据你自己的版本选择想看的功能点,例如我的项目使用的版本是4.2.1.RELEASE,想查看怎么配置 step,查看地址是: https://docs.spri
阅读全文
posted @
2020-03-26 07:56
梦幻朵颜
阅读(930)
推荐(0) 编辑
SpringBoot的Resource 的 3 种实例方法
摘要:项目结构: project-name src/main/java src/main/resource data input.txt 输入文件目录在src/main/resource目录下的data/input.txt 文件 第 1 种方式:(推荐) 在class类里获取Resource对象: @Va
阅读全文
posted @
2020-03-24 21:33
梦幻朵颜
阅读(3348)
推荐(0) 编辑
Springboot在application.properties里配置打印 SQL 和参数
摘要:application.properties配置参考 1、自定义log配置文件 logging.config=classpath:logback-spring.xml 2、具体某个包路径使用什么日志级别: logging.level.org.springframework=INFO 3、打印控制台日
阅读全文
posted @
2020-03-21 22:41
梦幻朵颜
阅读(4829)
推荐(0) 编辑