Spring WebFlux introduces reactive programming in Spring Boot, and developers may encounter the warning 'Possibly blocking call in non-blocking context could lead to thread starvation'. This post walks through reproducing the warning, exploring its risks, and offering solutions. These include adopting reactive alternatives or using a separate thread pool for blocking operations to avoid blocking the HTTP request handling threads. Practical code examples illustrate both approaches.

4m read timeFrom feeds.feedblitz.com
Post cover image
Table of contents
1. Overview2. Blocking Method in Non-Blocking Context3. Understanding the Warning4. Fixing the Issue5. Conclusion
1 Comment

Sort: