Я поделился этим DTO возвращает null при вызове из клиента Rest с использованием весенней загрузки вчера, и большое спасибо @RoddyoftheFrozenPeas за указание на ошибку.Это было решено.Теперь он видит значения от клиента Rest, однако он всегда возвращает 500 внутренних ошибок сервера и NullPointerException для всех сделанных мной вызовов.Что я могу сделать, чтобы передать это?
Ошибка
web - 2019-09-29 14:36:11,814 [http-nio-8081-exec-1] DEBUG o.b.w.c.RegistrationController - Registering user account with information: UserDto [firstName=Kehinde, lastName=Adeoya, username=ken4ward, password=o201115@...Adel, matchingPassword=o201115@...Adel, email=kadeoya@oltega.com, isUsing2FA=false, role=ROLE_ADMIN]
web - 2019-09-29 14:36:11,823 [http-nio-8081-exec-1] ERROR o.b.w.c.e.RestResponseEntityExceptionHandler - 500 Status Code
j.l.NullPointerException: null
at o.b.s.UserService.save(UserService.java:81)
at o.b.w.c.RegistrationController.registerUserAccount(RegistrationController.java:86)
at j.i.r.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)
at j.i.r.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at j.i.r.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
... 75 frames truncated
Это то, что я отправил от клиента Rest:
{
"firstName": "Kehinde",
"lastName": "Adeoya",
"username": "ken4ward",
"email": "kadeoya@oltega.com",
"password": "o201115@Adel",
"matchingPassword": "o201115@Adel",
"statusName": "ROLE_ADMIN"
}
Это уровень сервиса накоторый возвращает ошибку нарушения (UserService)
public User save(UserDto user) {
Set<ConstraintViolation<UserDto>> violations = validator.validate(user);
if (violations.size() > 0) {
throw new BadRequestException();
}
............
Это контроллер
@RequestMapping(value = "/registration", method = RequestMethod.POST )
@ResponseBody
public User registerUserAccount(final UserDto accountDto, final HttpServletRequest request) {
final User registered = userInterface.save(accountDto);
eventPublisher.publishEvent(new OnRegistrationCompleteEvent(registered, request.getLocale(), getAppUrl(request)));
return registered;
}