【java反射】反射中获取类属性字段比较优雅的写法
摘要:for (Field field : object.getClass().getDeclaredFields()) { try { AccessController.doPrivileged(PrivilegedAction() -> { ReflectionUtils.makeAccessible
阅读全文
posted @
2024-06-23 12:15
人无名,则可专心练剑
编辑
【Java多线程】使用ThreadPoolTaskExecutor创建线程池
摘要:/** * 装饰器-将主线程上下文传入异步线程 * */ public class JalorContextDecorator implements TaskDecorator { @Override public Runnable decorate(Runnable runnable) { //
阅读全文
posted @
2024-06-21 00:28
人无名,则可专心练剑
编辑
Redisson分布式锁注解方式实现
摘要:/** * redission分布式锁,用来控制Scheduled定时任务 * */ @Sl4j @Aspect @Component public class LockAspect { private RedissonClient redissonClient; @Value("${spring.
阅读全文
posted @
2024-06-19 00:26
人无名,则可专心练剑
编辑
Redis方法注解式缓存
摘要:/** * 方法缓存注解 * * */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface MethodCache { /** * redisKey 的一部分 最终的 rediskey是
阅读全文
posted @
2024-06-17 23:15
人无名,则可专心练剑
阅读(30)
推荐(0) 编辑