-
Drools规则引擎实践直白总结
Drools规则引擎,网上大把相关的文章介绍,但我感觉不够直白,理解有些困难,且知识点没有集中比较分散、有些还是早前版本的内容,对与新手来说上手可能比较慢,而且比较容易走弯路,故我在深入研究并实践于项目中后,在空闲时间花费精力整理了这篇文章,分享出来... -
分享实用小工具:JAVA版本位运算工具类
前言将二进制数中的每位数字1或0代表着某种开关标记,1为是,0为否,则一个数字可以代表N位的开关标记值,可有效减少过多的变量定义 或 过多的表字段,同时也能在一些复杂的组合判断场景下利用位与、位或、异或等位运算实现简单高效的逻辑判断 JAVA版位运算... -
通过实现仿照FeignClient框架原理的示例来看清FeignClient的本质
前言FeignClient的实现原理网上一搜一大把,此处我就不详细再说明,比如:Feign原理 (图解) - 疯狂创客圈 - 博客园 (cnblogs.com) ,而且关于FeignClient的使用技巧我之前文章《feignclient各种使用技巧... -
分享自研实现的多数据源(支持同DB不同表、跨DB表、内存数据、外部系统数据等)分页查询工具类实现原理及使用
思考:提起分页查询,想必任何一个开发人员(不论是新手还是老手)都能快速编码实现,实现原理再简单不过,无非就是写一条SELECT查询的SQL语句,ORDER BY分页排序的字段, 再结合limit (页码-1),每页记录数,这样即可返回指定页码的分页记... -
任何Bean通过实现ProxyableBeanAccessor接口即可获得动态灵活的获取代理对象或原生对象的能力
如果一个BEAN类上加了@Transactional,则默认的该类及其子类的公开方法均会开启事务,但有时某些业务场景下某些公开的方法可能并不需要事务,那这种情况该如何做呢? 常规的做法: 针对不同的场景及事务传播特性,定义不同的公开方法【哪怕是同一种... -
关于JAVA泛型数组类型擦除引发的问题及解决方案
先看如下一个DEMO示例代码:(其中doBatchGet被子类重写了1次) 1234567891011121314151617181920212223242526272829303132333435public abstract class Base... -
小技巧大用处之Bean管理类工厂
有时我们经常需要将实现了某个基类或某个接口的所有Bean进行分类管理,在需要用到的时候按需获取实现了某个基类或某个接口的Bean实例对象,那么我们就需要Bean管理类工厂(即:工厂模式),实现Bean管理类工厂我总结了目前已知且常用的实现方式,敬请各... -
解释在Mybatis-Spring下@Mapper与@MapperScan为何不能同时生效以及实现动态条件注册Mapper接口
若项目中使用了@MapperScan注解后,则@Mapper注解不再生效,原因是:@MapperScan注解 会执行@Import(MapperScannerRegistrar.class),而MapperScannerRegistrar又会注册Ma... -
spring声明式事务(@Transactional)开发常犯的几个错误及解决办法
目前JAVA的微服务项目基本都是SSM结构(即:springCloud +springMVC+Mybatis),而其中Mybatis事务的管理也是交由spring来管理,大部份都是使用声明式事务(@Transactional)来进行事务一致性的管理,...
1