https://github.com/mybatis/mybatis-3/blob/1d68154c353b83aed792203c586a83f6e2e3146a/src/main/java/org/apache/ibatis/plugin/InterceptorChain.java#L30C36-L30C48

Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:911)
at java.util.ArrayList$Itr.next(ArrayList.java:861)
at org.apache.ibatis.plugin.InterceptorChain.pluginAll(InterceptorChain.java:30)
at org.apache.ibatis.session.Configuration.newResultSetHandler(Configuration.java:676)
at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:70)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:41)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:46)
at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:681)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:61)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
... 20 more

Comment From: harawata

Hello @siyuqxxx ,

This seems to mean that the statement is called before all interceptors are added. Could you explain how that happens?

Comment From: siyuqxxx

During service startup, async query db in @PostConstruct

Comment From: harawata

Can you provide a demo project with minimum setup? I would like to see what you are doing and how the issue occurs. Here are project templates and some examples: https://github.com/harawata/mybatis-issues

Comment From: oah1021

I think the query operation should be performed after all the interceptors have been added.

Comment From: harawata

No reply.