Tagged articles

ResponseEntity

3 articles · Page 1 of 1
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Jul 10, 2026 · Backend Development

Goodbye ResponseEntity: 4 Declarative Patterns for Cleaner Spring Boot APIs

The article shows how overusing ResponseEntity in Spring Boot controllers makes code noisy and mixes business logic with HTTP handling, and introduces four declarative alternatives—@ResponseStatus on methods or exceptions, direct object returns, global ProblemDetail via @ControllerAdvice, and a ResponseBodyAdvice wrapper—to produce cleaner, more testable APIs.

API designControllerAdviceProblemDetail
0 likes · 16 min read
Goodbye ResponseEntity: 4 Declarative Patterns for Cleaner Spring Boot APIs
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
May 20, 2024 · Backend Development

How to Fix Resource Leaks When Streaming Files in SpringBoot 3.2

This article explains why using a wrong Content‑Type header and not closing the InputStream when returning a Resource in SpringBoot 3.2 causes file‑handle leaks, and demonstrates three solutions—including try‑with‑resources, direct HttpServletResponse streaming, and custom Resource implementations—to safely download files even under high concurrency.

File DownloadResponseEntitySpringBoot
0 likes · 7 min read
How to Fix Resource Leaks When Streaming Files in SpringBoot 3.2