Please take a look at this small project https://github.com/OleksandrSankin/spring-boot-bug Build it via "mvn clean install" and you will see that three Tomcat instances will be running (project contains three tests)
What I figured out: - this issue started from spring-boot version 2.2.9 and is reproduced in latest 2.3.2 - if downgrade version till 2.2.8 - issue will disappear - if ignore the line at com.bug.AbstractTest:18 - issue will disappear
Why is this issue for me?
At work I have 600+ tests which runs against the standalone database (postgres). Running a separate Tomcat per each test cause the connection pool overflow at postgres side and failing the tests at the end. So I am not able to upgrade project from version 2.2.8 till the latest. Yep - I can rewrite the tests avoid using spybean but its a quite huge job.
Also after debugging I was able to find the point that can be useful - DefaultCacheAwareContextLoaderDelegate:121 (here makes a decision - create new context or not for test)
I've attached the screenshot - hope it would help
Comment From: dreis2211
Likely a duplicate of #22566
Comment From: wilkinsona
Indeed. Thanks, @dreis2211.