How to Implement a RESTful API with Versioning in Spring
Compare REST API versioning strategies in Spring and see working examples for URI, header, parameter and native Spring Framework 7 versioning.
2,882 posts about Java: questions with answers, tutorials and articles, newest first.
Compare REST API versioning strategies in Spring and see working examples for URI, header, parameter and native Spring Framework 7 versioning.
@JsonIgnore removes a property from JSON in both directions. Learn where to place it, when WRITE_ONLY is better, and how it fixes circular references.
Customise JSON serialization in Spring Boot using spring.jackson properties, customizer beans, modules and annotations without replacing the ObjectMapper.
Jackson's @JsonProperty renames and configures how Java members map to JSON. See renaming, creators, access control and why defaultValue does nothing.
Build custom Jackson serializers and deserializers using StdSerializer, StdDeserializer, annotations and SimpleModule, and learn when built-in annotations are enough.
ObjectMapper is the entry point of Jackson databind. See how it fits the library, how Spring Boot configures it, and how Jackson 3 changes it.
Spring converts JSON with Jackson: @RestController serializes responses, @RequestBody deserializes input, and annotations or spring.jackson properties tune it.
@RequestBody converts the HTTP request body into a Java object in Spring MVC. See examples with records, validation and the errors to expect.
AuthenticationFailureHandler decides what happens when a Spring Security login fails. See Spring Security 6 setup, redirect and JSON examples, and security tips.
Change login and access-denied messages in Spring Security 6 with message bundles, an AuthenticationFailureHandler, entry points and access denied handlers.
LogoutSuccessHandler decides what the client receives after a successful logout in Spring Security. See built-in handlers, a custom JSON handler and its setup.
CorsConfigurationSource tells Spring which CORS policy applies to each request. See how to define the bean, wire it into Spring Security and write a dynamic implementation.
Enable CORS in the SecurityFilterChain with a CorsConfigurationSource bean so preflight requests are answered before authentication and no longer fail with 401.
@Secured limits who may call a Spring method based on granted authorities. See how to enable it in Spring Security 6, its limits, and how it differs from @PreAuthorize.
HttpSecurity configures URL authorization, login, CSRF, sessions and filters in Spring Security. See modern SecurityFilterChain examples.
Configure Spring Security for a REST API using a stateless SecurityFilterChain, JWT or Basic auth, password hashing, method security and CORS.
@PreAuthorize checks a SpEL access rule before a method runs and throws AccessDeniedException when it fails. See how to enable it, write rules and avoid common mistakes.
JwtTokenProvider is a convention, not a library class: one component that signs and validates JWTs. See a jjwt 0.12 implementation and its security filter.
Build stateless JWT authentication in Spring Boot with Spring Security 6: a login endpoint issues tokens and the resource server validates bearer tokens.
Build a custom UserDetailsService that loads users from a database and plug it into Spring Security 6 with a SecurityFilterChain bean.