**Post Edit**: I have tried with a simple rest api hello world project with validating input here: <https://github.com/abidinberkay/testQuestion> still I can't find where I am doing smth wrong.

I have a dto class whose fields are marked with **@NotNull**

```
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

public class UserCreateRequest {

    @NotNull
    private String userName;

    @NotNull
    private String name;

    @NotNull
    private String surname;

    @NotNull
    private String job;

//Getters and Setters
}

```

And I am using this dto in a controler method with **@Valid** annotation

```
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping
    public UserCreateResponse createUser(@Valid @RequestBody UserCreateRequest userDto) {
        return userService.createUser(userDto);
    }

}

```

Whenever I send post request with null fields, it is still creating user with null values so @NotNull or @NotBlank validations are not working. How can I be sure that the request json will have these fields as specified in request class ?

Here is my sample postman request body(as you see only userName exists and all others are null):

```
{
    "userName" : "nnnnn"
}

```