The my demo application uses the lazy loading feature.

https://github.com/kazuki43zoo/demo-application/blob/d4c01469e28599556a11c19c9f2c92e189782e54/src/main/resources/com/kazuki43zoo/domain/repository/account/AccountRepository.xml#L14-L15

In this case, an ErrorContext does not removed from ThreadLocal when has been execute the lazy loading. As result, following log was outputted when the Tomcat instance will be stopped.

[INFO] [talledLocalContainer] Jun 30, 2020 6:29:33 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
[INFO] [talledLocalContainer] SEVERE: The web application [demo-application] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@7ca16621]) and a value of type [org.apache.ibatis.executor.ErrorContext] (value [
[INFO] [talledLocalContainer] ### The error may exist in com/kazuki43zoo/domain/repository/account/AccountRepository.xml
[INFO] [talledLocalContainer] ### The error may involve com.kazuki43zoo.domain.repository.account.AccountRepository.findOnePasswordLock
[INFO] [talledLocalContainer] ### The error occurred while handling results
[INFO] [talledLocalContainer] ### SQL: SELECT             account_uuid             ,failure_count         FROM             account_password_lock         WHERE             account_uuid = ?]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
[INFO] [talledLocalContainer] Jun 30, 2020 6:29:33 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
[INFO] [talledLocalContainer] SEVERE: The web application [demo-application] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@7ca16621]) and a value of type [org.apache.ibatis.executor.ErrorContext] (value [
[INFO] [talledLocalContainer] ### The error may exist in com/kazuki43zoo/domain/repository/account/AccountRepository.xml
[INFO] [talledLocalContainer] ### The error may involve com.kazuki43zoo.domain.repository.account.AccountRepository.findAllPasswordHistoryByAccountUuid
[INFO] [talledLocalContainer] ### The error occurred while handling results
[INFO] [talledLocalContainer] ### SQL: SELECT             account_uuid             ,password         FROM             account_password_histories         WHERE             account_uuid = ?]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
...

I think better that clear an ErrorContext when has been executed the lazy loading.