REQ-2010: 尝试解决pre环境的异常问题
This commit is contained in:
parent
06130725e3
commit
722805270e
@ -8,6 +8,8 @@ import org.apache.ibatis.plugin.InterceptorChain;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -16,6 +18,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
@ -26,11 +29,13 @@ import java.util.List;
|
||||
public class PaginationConfig implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private final SqlSessionFactory sessionFactory;
|
||||
private final ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(@NotNull ContextRefreshedEvent event) {
|
||||
try {
|
||||
repair();
|
||||
analyze();
|
||||
} catch (Exception e) {
|
||||
log.warn("failed to handle mybatis plugins", e);
|
||||
}
|
||||
@ -57,4 +62,12 @@ public class PaginationConfig implements ApplicationListener<ContextRefreshedEve
|
||||
}
|
||||
}
|
||||
|
||||
private void analyze() {
|
||||
Map<String, MybatisPlusInterceptor> name2Bean = beanFactory.getBeansOfType(MybatisPlusInterceptor.class);
|
||||
for (String name : name2Bean.keySet()) {
|
||||
BeanDefinition definition = beanFactory.getBeanDefinition(name);
|
||||
log.warn("analyze mybatis interceptor bean resource: {}", definition.getResourceDescription());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user