Exception

java.lang.IllegalArgumentException: No converter found for return value of type

Jungsoomin :) 2020. 12. 9. 17:49

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());
        }
    }

 

-끗-