Answer the question
In order to leave comments, you need to log in
Why is the class not building?
Hello!
when using Lombok, it works somehow crookedly (maybe)
for example, the class is not built: ErrorDto class
:
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErrorDto {
private String error;
@JsonProperty("error_description")
private String description;
}
@RequiredArgsConstructor
@Controller
public class CustomErrorController implements ErrorController {
private static final String PATH = "/error";
ErrorAttributes errorAttributes;
@RequestMapping(PATH)
public ResponseEntity<ErrorDto> error(WebRequest webRequest){
Map<String, Object> attributes = errorAttributes.getErrorAttributes(
webRequest,
ErrorAttributeOptions.of(ErrorAttributeOptions.Include.EXCEPTION, ErrorAttributeOptions.Include.MESSAGE)
);
// здесь вбрасывает ошибку
return ResponseEntity
.status((Integer) attributes.get("status"))
.body(ErrorDto.builder()
.error((String) attributes.get("status"))
.description((String) attributes.get("status"))
.build()
);
}
}
Answer the question
In order to leave comments, you need to log in
Good afternoon!
Usually, this problem occurs for two reasons:
1) there is no lombok plugin - https://projectlombok.org/setup/intellij
2) annotation processing is not enabled - https://www.jetbrains.com/help/idea/annotation-pro ...
Let me know if the above tips don't help.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question