How do you create a rate-limiting filter in Spring Boot?
Write a thread-safe rate-limiting filter in Spring Boot that returns 429 with Retry-After, handles proxies, and notes how to scale beyond one instance.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Write a thread-safe rate-limiting filter in Spring Boot that returns 429 with Retry-After, handles proxies, and notes how to scale beyond one instance.
Bucket4j adds token bucket rate limiting to Java apps, from a single JVM to Redis-backed clusters, and fits neatly into Spring Boot filters.
Compare Spring Boot rate limiting options and implement Resilience4j RateLimiter with properties, fallback and a global 429 handler.
Implement a custom Spring Cache with per-entry expiry, register it through a CacheManager and use it with @Cacheable, with tests and guidance on when to use Caffeine or Redis.
CacheManager is Spring's registry of named caches that hides the cache provider. See Boot auto-configuration and Caffeine and Redis setup examples.
Compare cache-aside, write-through and invalidate-on-write in Spring Boot, set TTL and size limits, prevent stampedes, and pick Caffeine or Redis.
@QueryMapping binds a Spring controller method to a GraphQL Query field. See schema setup, @Argument binding, return types and the related mapping annotations.
Use spring-boot-starter-graphql, a .graphqls schema and @QueryMapping or @MutationMapping controller methods to serve a GraphQL API from one endpoint.
@GraphQLApi belongs to GraphQL SPQR, not to Spring itself. Learn how it works and how it compares with Spring for GraphQL controllers.
Define a GraphQL schema in a .graphqls file and wire queries, mutations and nested fields to Spring controllers using Spring for GraphQL.
The spring-boot-starter-graphql dependency adds Spring for GraphQL to Spring Boot, exposing a /graphql endpoint and wiring schema fields to annotated controller methods.
Step-by-step guide to GraphQL in Spring Boot with Spring for GraphQL: schema, annotated controllers, JPA, GraphiQL, batch loading and testing.
@ApiOperation documented endpoints in Swagger 2 and Springfox. Learn what it does, why it is outdated and how to migrate to @Operation.
What springfox-swagger2 did, why it no longer works with modern Spring Boot, and how to migrate to springdoc-openapi with an annotation mapping table.
Understand why @RequestParam is used for multipart uploads in Spring, with examples for multiple files, validation, size limits and its limits.
Build a Spring Boot REST endpoint that accepts MultipartFile uploads, stores them safely, validates type and size, and returns clean errors.
MultipartFile represents a file uploaded in a multipart request in Spring. See its methods, a Spring Boot upload example, size limits and safe handling.
HttpMessageConverter converts HTTP bodies to Java objects and back in Spring MVC. Boot registers JSON, text and form converters automatically.
Customize JSON in Spring Boot with Jackson serializers and deserializers, attached through annotations, @JsonComponent or a Module bean, plus useful properties.
The Converter interface gives type conversion a single reusable contract. See how Spring's Converter works, when to use Formatter, and plain Java alternatives such as Function.