REQ-2010: 添加分析代码

This commit is contained in:
yanglin 2024-03-03 14:08:20 +08:00
parent cbe5b1a811
commit 0904e8a995

View File

@ -33,13 +33,13 @@ public class SqlSessionFactoryPostProcessor implements BeanPostProcessor {
return bean;
}
@SuppressWarnings("DataFlowIssue")
private void analyze(SqlSessionFactory sessionFactory) {
org.apache.ibatis.session.Configuration configuration = sessionFactory.getConfiguration();
Field chainField = ReflectionUtils.findField(configuration.getClass(), "interceptorChain");
Field modifiers = ReflectionUtils.findField(Field.class, "modifiers");
//noinspection DataFlowIssue
ReflectionUtils.setField(modifiers, chainField, chainField.getModifiers() & ~Modifier.FINAL);
chainField.setAccessible(true);
ReflectionUtils.setField(modifiers, chainField, chainField.getModifiers() & ~Modifier.FINAL);
ReflectionUtils.setField(chainField, configuration, new AnalyzeInterceptorChain());
}