How to Create a REST Client Using WebClient in Spring Boot
Use WebClient in Spring Boot to call REST APIs with GET and POST requests, error handling, timeouts and retries, and learn when RestClient fits better.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Use WebClient in Spring Boot to call REST APIs with GET and POST requests, error handling, timeouts and retries, and learn when RestClient fits better.
RestTemplate simplified calling REST APIs from Spring. See how it works, its status today and how RestClient and WebClient replace it.
Call third-party REST APIs from Spring Boot with RestClient, WebClient or an HTTP interface, and handle timeouts, errors and retries properly.
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.