Most Spring Boot applications start with a beautifully boring main class.
Then one day we need caching. We add @EnableCaching.
Then we need async processing. We add @EnableAsync.
Then scheduling. Then JPA auditing. Then maybe something else.
Before we know it, the main class has become the place where every framework feature goes to live.
At first glance, this feels harmless. The application starts. The feature works. Everybody moves on.
This works great… until a slice test gets involved.
Let’s look at why adding every @EnableXXX annotation to the Spring Boot main class can make your tests more fragile, and what I prefer to do instead.








