SpringBoot 사용시 ResponseEnitty 를 넘겨줄때 생겨났다.
Getter 만들자..
public class Message implements Serializable {
private String msg;
public String getMsg() {
return msg;
}
public Message(MessageBuilder builder) {
this.msg = builder.msg;
}
public static MessageBuilder builder(){
return new MessageBuilder();
}
public static class MessageBuilder {
private String msg;
private MessageBuilder() {}
public MessageBuilder setMsg(String msg) {
this.msg = msg;
return this;
}
public Message build(){
return new Message(this);
}
}
}
//
@PostMapping("/clientone/feign/account/register")
public ResponseEntity<Object> LoggingAndFeignRegisterAccount(@RequestBody Map<String,String> map) {
LOGGER.warn("============================================");
LOGGER.warn("Client-One Controller , Active Feign ");
LOGGER.warn("============================================");
try {
return accountProvideService.processingRegisterAccount(map);
}catch (FeignException ex){
LOGGER.warn("=================>>>>>Check : "+ex.getMessage()+" / "+ex.getClass() + " / ");
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Message.builder().setMsg(ex.getMessage()).build());
}
}
-끗-
'Exception' 카테고리의 다른 글
Eureka Server 관련 ,@SpringBootTest 구동 실패 (0) | 2020.12.11 |
---|---|
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed (0) | 2020.12.11 |
엑셀 파일 로딩시 형변환에러 발생 Safe하게 하기 (0) | 2020.10.14 |
log 단계 (0) | 2020.08.20 |
The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler (0) | 2020.08.09 |