-
mybatis 오류 / attempted to return null from a method with a primitive return type (int)공부/SpringBoot & Spring 2022. 7. 7. 11:18728x90
mybatis를 통하여 data의 존재 유무를, count를 통해 반환하도록 작성하였다. 그랬더니 다음과 같은 오류가 발생하는 것을 확인하였다.
원문 : attempted to return null from a method with a primitive return type (int).
번역 : 원시 반환 형식(int)을 사용하여 메서드에서 null을 반환하려고 했습니다.말 그대로, null 값을 처리할 수 없는 int type에 null 값(혹은 공백)이 들어간다는 오류이다. 해결 방법은 간단하다. return 되는 과정을 int 에서 Integer로 치환만 시켜주면 된다.
728x90'공부 > SpringBoot & Spring' 카테고리의 다른 글
MyBatis: Mapped Statements collection already contains value for ~ 에러 (0) 2022.07.11 스프링 시큐리티(spring security) deprecated (0) 2022.07.11 [Thymeleaf] 문자열 조합(합치기) (1) 2022.07.05 Spring Boot Embeded Tomcat 내장 톰캣 application.properties 설정 (0) 2022.06.27 spring security + thymeleaf 기능? 적용? (0) 2022.06.24