What is the significance of the WebClient class in Spring WebFlux?
WebClient is Spring's non-blocking, reactive HTTP client. See how to build it, call APIs, handle errors, set timeouts and when to choose it over RestClient.
2,886 posts about Java: questions with answers, tutorials and articles, newest first.
WebClient is Spring's non-blocking, reactive HTTP client. See how to build it, call APIs, handle errors, set timeouts and when to choose it over RestClient.
Set up a RestTemplate bean with RestTemplateBuilder, timeouts, interceptors and error handling, and see how RestClient replaces it in new code.
RestTemplate is Spring's blocking HTTP client for consuming REST APIs. See GET, POST, PUT and DELETE examples, error handling and the RestClient alternative.
Call external REST APIs from Spring Boot with RestClient and @HttpExchange: GET, POST, timeouts, error handling, tests and when to use WebClient.
Spring has no GraphQLFilter class. Use WebGraphQlInterceptor, servlet filters and instrumentation to intercept and secure GraphQL requests.
Protect the GraphQL endpoint with JWT, authorize each query, mutation and field with method security, and limit query depth and complexity.
DataFetcher resolves one field in a GraphQL schema. See how Spring for GraphQL wraps controllers, batches loads and registers fetchers manually.
Add the Spring for GraphQL starter, define a schema and map fields with @QueryMapping, @SchemaMapping and @BatchMapping. Includes argument binding and a controller test.
Define custom exceptions and handle them globally with @ControllerAdvice, ProblemDetail JSON responses and ResponseEntityExceptionHandler in Spring 6.
@ResponseStatus sets the HTTP status for a Spring controller method or exception class. Learn how it works, its limits and when to use ResponseStatusException.
Create custom 404 and 500 pages in Spring MVC and Spring Boot, map exceptions with @ControllerAdvice and return JSON problem details for APIs.
@Controller marks a class as a Spring MVC web controller whose mapped methods handle requests and usually return view names. Compare it with @RestController and see testing tips.
Define a messageSource bean or use spring.messages properties, add per-language files and a LocaleResolver, and resolve messages by locale in Spring.
LocaleResolver tells Spring MVC which Locale applies to each request. See the built-in resolvers, LocaleChangeInterceptor and MessageSource setup.
Configure a MessageSource, a LocaleResolver and a LocaleChangeInterceptor so a Spring web application can show text in the user's language.
Save new users as disabled, email a random expiring token, and enable the account on click. A Spring Boot 3 and Spring Security 6 example with hardening tips.
@EnableResourceServer belonged to retired Spring Security OAuth. Learn what it did and how to build a JWT resource server with Spring Security 6 today.
Define a JwtEncoder, JwtDecoder and a stateless SecurityFilterChain with oauth2ResourceServer. Includes login, roles claims and token security practices.
@EnableAuthorizationServer comes from the end-of-life Spring Security OAuth project. See what it did and how Spring Authorization Server replaces it.
@EnableGlobalMethodSecurity turns on method-level authorization in Spring Security. It is deprecated; see how @EnableMethodSecurity replaces it.