Keep Spring at Arm's Length!
summary
Argues that Spring’s invasiveness leads to hidden coupling and runtime surprises and proposes concrete fixes: use constructor injection instead of field injection to reduce framework coupling, avoid relying on @Transactional proxies (use TransactionTemplate or direct JDBC/jOOQ because proxies don’t work for private methods), remove shared “common” classpath modules to prevent unexpected auto-configuration, and keep the framework at the edges using ports-and-adapters. Presents a migration pattern using an event-handler map that enabled swapping RabbitMQ for Kafka in about four hours and reports this approach works in practice.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 3:01Framework vs library
- 6:13Framework downsides
- 13:39Debugging Spring traps
- 20:45Microservices dependencies
- 25:48Reducing invasiveness
- 30:24Avoiding framework magic
- 34:43Hexagonal architecture benefits
- 38:15Migrating RabbitMQ to Kafka
- 41:44Spring alternatives summary
related talks
01h 00mFantastic Frameworks and How to Avoid Them
27mThe Inner Secrets of Spring
49mSpring, Jakarta EE, CDI and Other Pathologies
53mSpring Puzzlers
01h 22mModern Java Component Design with Spring Framework 4.2
41mJava Beyond Frameworks: Avoiding Lock-In with Agnostic Design
56mSpring For Architects
49mOn @annotations - liberate yourselves from demons
