IT/Java

Cannot invoke "java.lang.Integer.intValue()"

binary? 2024. 4. 22. 12:26

API 개발 하다가 아래와 같은 오류가 발생하였다.

Cannot invoke "java.lang.Integer.intValue()" because the return value of "com.example.studentmanagement.dto.StudentDTO.getAge()"

확인해보니 DTO 쪽에 아래처럼 int로 선언하지 않고 Integer로 선언한 것이 있었다.

Integer -> int로 수정 후 정상 작동하였다.