Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count the number of times the spring boot loads on spring tests?

I've a app with spring boot tests, can I enforce the number of times that spring boot is loaded? so if someone will load another spring boot I'll will warn about it.

like image 327
Michal Avatar asked Oct 15 '25 04:10

Michal


1 Answers

The question is a bit general and my answer may be not exactly what is wanted.

With logging.level.org.springframework.test.context.cache: debug you can monitor how many contexts are loaded, for example this project use 7 contexts:

Spring test ApplicationContext cache statistics: [DefaultContextCache@3655a68c size = 7, maxSize = 32, parentContextCount = 0, hitCount = 1780, missCount = 7]

like image 111
michaldo Avatar answered Oct 16 '25 18:10

michaldo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!