티스토리 뷰
@Builder
public class Test<T> {
private T a;
private String b;
private String c;
public static Test tt (Object responseData) {
return CommonResponse.builder()
.responseData(responseData)
.b("호롤록")
.c("호로로롥").build();
}
}
@GetMapping("/test")
public Mono<Test> test() {
return Mono.just(Test.tt("안녕안녕 test"));
}
Test code 실행시 아래와 같은 에러 남
org.springframework.core.codec.CodecException: Type definition error: [simple type, class sb_admin.common.response.CommonResponse]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of sb_admin.common.response.CommonResponse
(no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator) at [Source: (org.springframework.core.io.buffer.DefaultDataBuffer$DefaultDataBufferInputStream); line: 1, column: 2] at org.springframework.http.codec.json.AbstractJackson2Decoder.processException(AbstractJackson2Decoder.java:211) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): |_ checkpoint ⇢ Body from GET /test [DefaultClientResponse]
no Creators, like default constructor, exist => 생성자 없다는 뜻임
@Builder
@Getter
@NoArgsConstructor
public class Test<T> {
private T a;
private String b;
private String c;
public static Test tt (Object responseData) {
return CommonResponse.builder()
.responseData(responseData)
.b("호롤록")
.c("호로로롥").build();
}
}
생성자를 붙였지만 추가적인 에러가 남
Error:(9, 1) java: constructor CommonResponse in class sb_admin.common.response.CommonResponse cannot be applied to given types; required: no arguments found: T,java.lang.String,sb_admin.common.response.CommonState reason: actual and formal argument lists differ in length
@AllArgsConstructor 붙여서 에러 해결
'개발 일지 > <일부 비공개>회사 일기' 카테고리의 다른 글
입사 한달째 회고 (3) | 2020.06.26 |
---|
- Total
- Today
- Yesterday
- 개발일지
- 한 입 크기로 잘라먹는 리액트
- spring-boot
- springboot
- 스터디 회고
- 개발
- body
- RequestHandler
- Spring
- Gradle
- 프로그래머스
- 자바스크립트
- Java
- HTTP
- JAR
- 일지
- @Autowired
- 인텔리J
- MySQL
- 모듈
- web
- Spring Boot
- graphQL
- 회고
- 멀티모듈
- Request Handler
- homebrew
- header
- mapping
- JavaScript
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |