How do you create a custom caching implementation in Spring Boot?
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.
2,881 posts about Java: questions with answers, tutorials and articles, newest first.
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.
onErrorResume lets a reactive pipeline recover from an error by switching to a fallback Mono or Flux. Learn the overloads, examples and related operators.
Handle errors in Mono and Flux with onErrorResume, onErrorMap, doOnError and retryWhen, then add central HTTP error handling in WebFlux.
Learn how Mono and Flux are created, transformed and tested in Reactor, including backpressure and error handling operators.