How do you create a custom cache configuration in Spring Boot?
Configure caching in Spring Boot with properties or a CacheManager bean, using Caffeine or Redis with per-cache size and time-to-live settings.
2,881 posts about Java: questions with answers, tutorials and articles, newest first.
Configure caching in Spring Boot with properties or a CacheManager bean, using Caffeine or Redis with per-cache size and time-to-live settings.
spring-boot-starter-cache enables annotation-based caching with @Cacheable and friends, backed by Caffeine, Redis or another cache provider.
Run background work in Spring Boot with @Async, tuned executors and @Scheduled, and learn when to move to Quartz, JobRunr or a message queue.
TaskExecutor is Spring's abstraction for running tasks asynchronously. See the main implementations, pool configuration, @Async usage and virtual thread support.
Tune the auto-configured applicationTaskExecutor, define a custom ThreadPoolTaskExecutor for @Async and enable virtual threads on Java 21+.
Use @RestControllerAdvice with @ExceptionHandler methods to return consistent ProblemDetail errors, including validation failures and a safe fallback.
The @ExceptionHandler annotation turns exceptions thrown in Spring MVC controllers into controlled responses, locally or through a global controller advice.
@EnableWebMvcSecurity was deprecated in Spring Security 4.0 and later removed. See what it did and how to migrate to @EnableWebSecurity.
Enable rememberMe() in a SecurityFilterChain, add the login checkbox, and use persistent database tokens to keep users signed in safely.
LogoutSuccessHandler decides what the user sees after a successful Spring Security logout: a redirect, a status code or JSON. Includes Spring Security 6 examples.
Spring Security logs users out through a POST to /logout by default. Learn how to configure it, customise the result and handle JWT or REST clients.
Add RBAC to Spring Boot with a SecurityFilterChain, database-backed roles, method security and tests, using the current Spring Security 6 API.
Build a custom authentication filter for Spring Security 6 and Spring Boot 3, from the filter and provider to SecurityFilterChain registration and tests.
Hash passwords in Spring Boot with a PasswordEncoder bean: BCrypt, Argon2, the delegating encoder, login checks and hash upgrades.
AuthenticationProvider verifies one kind of authentication request in Spring Security. See how it works with ProviderManager and how to write and register a custom one.
Implement AuthenticationProvider, verify credentials with a PasswordEncoder and register it in a SecurityFilterChain bean. Spring Security 6 examples.
@AuthenticationPrincipal injects the authenticated principal into controller methods. See typed examples for UserDetails, JWT and OIDC users, plus common pitfalls.
Store users with BCrypt-hashed passwords, load them with a UserDetailsService and secure URLs with a SecurityFilterChain bean in Spring Boot 3.
@EnableGlobalMethodSecurity enabled method-level security but is deprecated since Spring Security 5.8. Learn how @EnableMethodSecurity replaces it.
Set up Spring Security in Spring Boot with a SecurityFilterChain, form login, database users, password hashing and method-level authorization.