
Fix MissingServletRequestParameterException in Spring MVC
Fix the 400 error for a missing request parameter in Spring MVC with optional parameters, defaults, correct parameter names and the right annotation.
Tag
51 posts

Fix the 400 error for a missing request parameter in Spring MVC with optional parameters, defaults, correct parameter names and the right annotation.

Fix the 400 Bad Request caused by a request body Spring MVC cannot read, from an empty body to a wrong type, a bad enum or malformed JSON.

Fix the 415 Unsupported Media Type error by sending the right Content-Type header, matching the consumes attribute and checking the message converters.

Fix a 405 Method Not Allowed from a Spring MVC endpoint by matching the HTTP verb, the path and redirects that turn a POST into a GET.

Implement cursor (keyset) pagination in a Spring Boot API with an opaque cursor, a stable sort and a limit plus one query, using JdbcClient or Spring Data.

Add ETags to a Spring REST API: ShallowEtagHeaderFilter, strong ETags from a version, If-None-Match for 304 responses and If-Match for lost update protection.

Fix CORS errors from a browser calling a Spring Boot API by configuring allowed origins, methods and credentials, with and without Spring Security.

Implement an Idempotency-Key header in Spring Boot so a retried POST returns the first result: key storage, request hashing, concurrency and expiry.

Document a Java REST API with OpenAPI 3: springdoc-openapi in Spring Boot, annotations for summaries and responses, security schemes and exporting the spec.

Detect the Hibernate N plus 1 query problem with a statement count, then remove it with a fetch join, an entity graph or batch fetching.

Wire a Vaadin application into Spring Boot so views get services by constructor injection, with the right scopes, security and a production build.

Find why Spring cannot supply a bean of the type you asked for, from component scanning and missing annotations to profiles and test slices.