Spring Internals
Spring Internals
What the Framework Does When You Are Not Looking.
This book targets senior Java developers who use Spring daily, know the annotations, and have hit a wall when something does not behave as the documentation says it should. Never explains what dependency injection is. Never defines a filter from scratch. The reader has a running Spring Boot application. This book explains what Spring is actually doing inside it.
The through-line system is a multi-tenant SaaS backend: REST and reactive API layers, JWT-secured endpoints, transactional order processing, async notification dispatch, Spring Data repositories, a custom starter shared across services, and a Spring Cloud-managed service mesh. Every chapter uses this system to demonstrate Spring internals in a context that reflects real production architecture rather than toy examples.
Three positions run through every chapter:
The annotation is never the explanation. @Transactional, @Autowired, @EnableAutoConfiguration, @PreAuthorize all hide a significant amount of infrastructure. Understanding what they hide is not optional for engineers who debug production issues, write custom starters, or design library code that other Spring applications consume. The annotation is where the chapter starts, not where it ends.
Proxies are the answer to almost every Spring mystery. Self-invocation breaking @Transactional, @Cacheable not firing on internal calls, @Async having no effect, security annotations being bypassed on direct method calls: every one of these is a proxy problem. Understanding JDK dynamic proxies and CGLIB at the bytecode level resolves an entire category of Spring production bugs.
Auto-configuration is an engineering discipline, not magic. The condition evaluation chain, the import candidates mechanism, and the @ConditionalOn* hierarchy are deterministic and inspectable. Engineers who understand them write better starters, debug bean registration failures in minutes, and stop adding @ComponentScan in desperation.
This book was generated using AI assistance.