I want to be able to define certain variables as not null in Spring's @RequestBody. That way Spring's controller will reject any requests whose body doesn't have certain variables that I define as critical. I've tried the code below however it doesn't work:
The controller:
@PutMapping("/")
ResponseEntity updateOptions(
@RequestBody RequestDto requestDto
);
The RequestDto, I want the first parameter to always be filled:
import javax.validation.constraints.NotNull;
public class RequestDto {
@NotNull
String id;
String message;
}