随笔分类 -  Java

摘要:核心和最大线程数(Core and maximum pool sizes) ThreadPoolExecutor 会根据指定的 corePoolSize 和 maximunPoolSize 自动调整当前线程池内线程数量(通过 getPoolSize 可以获取当前线程数量)。 值得注意的是:当 cor 阅读全文
posted @ 2025-03-06 20:23 newbieking 阅读(55) 评论(0) 推荐(0)
摘要:未重写Object的finalize方法 public static class MyObject { } 使用 PhantomReference 来监听引用是否被回收 ReferenceQueue<Object> queue = new ReferenceQueue<>(); MyObject o 阅读全文
posted @ 2025-03-05 11:57 newbieking 阅读(24) 评论(0) 推荐(0)
摘要:Java copyProperties方法 Spring的BeanUtils不会copy字段名相同但类型不同的属性 if (readMethod != null && ClassUtils.isAssignable(writeMethod.getParameterTypes()[0], readMe 阅读全文
posted @ 2025-01-15 10:10 newbieking 阅读(15) 评论(0) 推荐(0)
摘要:可以使用 spring spi 和 import 两种方法 1. 导入 starter 依赖 1.1. maven 管理工具 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starte 阅读全文
posted @ 2024-03-16 11:26 newbieking 阅读(121) 评论(0) 推荐(0)