This bug https://github.com/spring-projects/spring-boot/issues/33830 was fixed with this commit https://github.com/spring-projects/spring-boot/commit/9940fcfe77469975bfb621b1882464fcd8f421f8 and released in 2.7.9.

I have a FactoryBean I use to create a context object for my tests. The context is quite expensive to create and I want an instance-per-test. FactoryBean.isSingleton() returns false. Up until 2.7.8, this all worked as expected.

Following the change above, getObject is now called for every test run that ends up resetting mocks.

My understanding of the above issue was that it needs to reset mocks that are singletons. While the FactoryBean itself is a singleton, the objects produced by it are not. I'm not sure the result of this change would be what is expected.