REQ-2010: 添加分析代码
This commit is contained in:
parent
9dafc0ad21
commit
42895736fb
@ -1,5 +1,7 @@
|
||||
package cn.axzo.msg.center.notices.client.config;
|
||||
|
||||
import cn.axzo.trade.datasecurity.mybatisplus.interceptor.MybatisPlusCryptInterceptor;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.InterceptorChain;
|
||||
@ -12,13 +14,18 @@ import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SqlSessionFactoryPostProcessor implements BeanPostProcessor {
|
||||
public class MybatisInterceptorAnalyzeProcessor implements BeanPostProcessor {
|
||||
|
||||
private static final Set<Class<?>> EXPECTED_INTERCEPTORS = Sets.newHashSet(
|
||||
MybatisPlusCryptInterceptor.class,
|
||||
BeautifulPaginationInterceptor.class);
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(
|
||||
@ -48,8 +55,10 @@ public class SqlSessionFactoryPostProcessor implements BeanPostProcessor {
|
||||
@Override
|
||||
public void addInterceptor(Interceptor interceptor) {
|
||||
super.addInterceptor(interceptor);
|
||||
if (interceptor.getClass() != BeautifulPaginationInterceptor.class)
|
||||
log.info("Unexpected interceptor={}", interceptor.getClass().getName(), new RuntimeException());
|
||||
if (EXPECTED_INTERCEPTORS.contains(interceptor.getClass()))
|
||||
log.info("Adding interceptor={}", interceptor.getClass().getName());
|
||||
else
|
||||
log.warn("Unexpected interceptor={}", interceptor.getClass().getName(), new RuntimeException());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user