Virtual Threads in Spring Boot, and the One Thing That Breaks
What Project Loom changes for a typical Spring web application, how to turn it on, and why synchronized blocks and ThreadLocal need a second look.
- Java
- Spring Boot
- Performance
- Concurrency
Writing
Short, focused explainers on the things that come up most often in the comments.
What Project Loom changes for a typical Spring web application, how to turn it on, and why synchronized blocks and ThreadLocal need a second look.
Why lazy collections blow up outside the transaction, and which of the four standard fixes is right for your case.
What actually happens between a request hitting Tomcat and your controller method running, and how to configure it without guessing.
The seven propagation modes in Spring, which two you actually need, and why REQUIRES_NEW deadlocks more often than people expect.
How @Cacheable actually works, why it silently does nothing half the time, and the invalidation rules that keep a cache honest.
The mechanism behind the magic: conditions, ordering, and how to see exactly why a bean did or did not appear.
Transient, managed, detached and removed. Understanding these explains most of the surprising things Hibernate does.
@SpringBootTest is not the only option. What @WebMvcTest and @DataJpaTest load, and why your test suite is slow without them.
What the compiler actually enforces, why modern Java leans unchecked, and how to stop losing stack traces.
The rules both methods have to follow together, what breaks when they do not, and why JPA entities are a special case.
The three rules for Optional, why it does not belong on fields or parameters, and the methods that replace your if statements.
How a stream pipeline actually executes, the collectors worth memorising, and the cases where a for loop is still the right answer.