What Is the Significance of @CacheEvict in Spring?
@CacheEvict invalidates cached data in Spring when the source changes. Five practical scenarios, a test and the mistakes to avoid.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
@CacheEvict invalidates cached data in Spring when the source changes. Five practical scenarios, a test and the mistakes to avoid.
@CachePut always runs the method and stores its return value in the cache. Learn the key rules, conditions and pitfalls with a Spring Boot example.
Build an HttpGraphQlClient or HttpSyncGraphQlClient in Spring Boot, send GraphQL queries and mutations, map the response to Java types and handle errors.
Spring Boot auto-configures a CacheManager from your classpath. Learn the spring.cache properties and customizers for Caffeine, Redis and Ehcache 3.
Step-by-step Spring Boot caching: enable it, use @Cacheable, @CachePut and @CacheEvict, configure Caffeine with size and expiry, and avoid pitfalls.
Use @RestControllerAdvice, @ExceptionHandler and ProblemDetail to return consistent, safe error responses from a Spring Boot REST API.
Use RestClient for synchronous calls and WebClient for reactive ones. This guide shows GET, POST, PUT and DELETE, error handling, timeouts and moving off RestTemplate.
RestTemplate is Spring's blocking HTTP client for consuming REST APIs. Learn how to configure and use it, and why RestClient is now preferred.
Learn how to consume external APIs in Spring Boot using RestClient, WebClient and declarative HTTP interfaces, with timeouts, auth, error handling and tests.
@ResponseBody writes a return value to the response body, but file downloads also need headers. See the safe patterns for small, large and streamed files.
Learn how to return files from a Spring Boot controller with Content-Disposition, link them from a Thymeleaf template and block path traversal.
InputStreamResource adapts a one-shot InputStream to Spring's Resource type. See file download examples, the read-once rule and when to use other Resource classes.
Serve safe file downloads from a Spring Boot controller and link to them from Thymeleaf templates, with correct headers, 404 handling and path checks.
UserDetails is the Spring Security interface that describes a user: username, password hash, authorities and account flags. Learn how to implement it.
Implement UserDetails, return it from a UserDetailsService and register a SecurityFilterChain and PasswordEncoder, with working Spring Security 6+ code.
Store users with hashed passwords, expose a validated registration endpoint, load them with UserDetailsService and enable form login in a SecurityFilterChain bean.
SecurityFilterChain is the bean that configures Spring Security for web requests. See how to define, order and extend chains, and how it replaced WebSecurityConfigurerAdapter.
Build a JwtService with jjwt 0.12, add a OncePerRequestFilter that authenticates bearer tokens, and configure a stateless Spring Security chain.
WebSecurityConfigurerAdapter was deprecated in Spring Security 5.7 and removed in 6.0. See what it did and how to migrate to SecurityFilterChain beans.
Configure Spring Security in Spring Boot 3 with a SecurityFilterChain bean, URL rules, password encoding, stateless API chains and method security.