所有类
| 类 | 说明 |
|---|---|
| AbstractStream<T> | |
| Aggregator<T,R> | |
| Comparator<T> | |
| CustomException | |
| DataSourceEnum | |
| DynamicDataContextHolder | |
| DynamicDataSource |
动态获取数据源Key
|
| DynamicDataSourceAspect | |
| DynamicDataSourceRegister | |
| EventTypeEnum |
状态码,长度六位
1-2位标记类型
第3位标记Level(0,1:Info,2:Debug,3:Trace,4:Warn,5:Error,6:Fatal)
4-6位标记具体错误代码
1-2归属划分:10-59为common公共code,统一定义在common的,其他服务允许定义自己的EventTypeEnum,为了做区分,防止统一,最好是分区间段的,公共的尽量放
common中,如catalog service下的EventTypeEnum为71-73,business下75,就可以所有log的EventType都唯一,非必要的,每个服务下唯一即可
|
| GlobalExceptionHandler | |
| Grouping<TKey,TElement> |
Represents a collection of TElements that had been grouped through the TKey.
|
| JsonData<T> | |
| Linq | |
| MapStream<K,V> | |
| OrderedStream<T> | |
| Predicate<T> | |
| ReverseListIterator<T> | |
| Selector<T,R> | |
| SiteEnum | |
| Stream<T> |
Decorates
Iterable<T> objects to enable use of Linq like expressions. |
| StringUtils | |
| SwaggerConfig | |
| TargetDataBase |
标记数据源,配合threadlocal的参数通过AOP实现自动切换数据源
核心code在DynamicDataSourceAspect下changeDataSource
目前支持格式示例:record,%s.part,可以有一个参数位,运行时会被替换为DynamicDataContextHolder中获取的site,替换后格式为record,[site].part
名字要和properties中配置的custom.datasource.names下的名字保持一致,特别是大小写问题,site统一小写
使用时需要在接口,class和method上加注解,标机dao下的方法要查询的datasource名字,接口必须是代理类,否则会因为实现类不继承接口注解造成无法拦截
site不一定需要,特殊业务需求,需要同一分code运行多个site的多套数据库,属于二维关系
用于标记Dao的数据库类型,只区分数据库,不区分Site,配合Site可以达到自动匹配DataSource
可以标记Class,interface,也可以标记Method,参考DynamicDataSourceAspect,springboot 2.x.x才可以标记接口,Jpa和Mybatis这种代理生成
实现类的要基于Aop 5.X(springboot 2.x.x)才能通过Aop切入
Jpa,Mybatis都可以使用
每个Dao层的同一个Mapper,Reposity下的应该都是一个数据库的操作,所以直接标记在Class上,维护Dao的人员负责维护Dao和datasource的关系
这样Service层和Control等其他调用者不用管Dao的DataSource
是谁,只需要切换自己需要的Site,Dao下的method在执行时会结合threadlocal中的site和Dao上标记的数据库类型自动切换datasource
|
| ThreadPoolConfig |