Springboot Kotlin 에서 @InitBinder 사용하기 (@InitBinder methods must not return a value (should be void): 에러 해결)

2023. 8. 31. 15:01·Error Note
반응형

Kotlin 에서 @InitBinder 를 사용할 때,

API 가 실행되는 시점에 InitBinder 함수가 실행되며,

 

@InitBinder methods must not return a value (should be void):

 

에러가 발생했습니다.

 

분명,

@ControllerAdvice
class GlobalControllerAdvice {
    @InitBinder
    fun initBinder(binder: WebDataBinder){
    }
}

위와 같이 return 을 없는 것으로 처리를 했는데도 return 이 void 가 아니라고 되어있는데,

 

이는,

@ControllerAdvice
class GlobalControllerAdvice {
    @InitBinder
    fun initBinder(binder: WebDataBinder) : Unit? {
        return null
    }
}

위와 같이 명시적으로 return 값을 null 로 반환해주면 해결됩니다.

반응형

'Error Note' 카테고리의 다른 글

Python Fastapi FormData alias is not working 2025-04-22  (0) 2025.04.22
Docker failed: port is already allocated. 에러 발생  (0) 2024.09.29
docker compose 에서 network_mode: "host" 설정 시 local 에서 접근 불가.  (0) 2024.09.29
Springboot Gradle 빌드시, java.lang.IllegalStateException: Module entity with name 에러 발생  (0) 2023.08.30
SourceTree Git 여러 계정 사용하기 (SSH)  (0) 2023.08.30
'Error Note' 카테고리의 다른 글
  • Docker failed: port is already allocated. 에러 발생
  • docker compose 에서 network_mode: "host" 설정 시 local 에서 접근 불가.
  • Springboot Gradle 빌드시, java.lang.IllegalStateException: Module entity with name 에러 발생
  • SourceTree Git 여러 계정 사용하기 (SSH)
Railly Linker
Railly Linker
IT 지식 정리 및 공유 블로그
  • Railly Linker
    Railly`s IT 정리노트
    Railly Linker
  • 전체
    오늘
    어제
  • 공지사항

    • 분류 전체보기 (176)
      • Programming (80)
        • BackEnd (40)
        • FrontEnd (14)
        • DBMS (3)
        • ETC (23)
      • Study (88)
        • Computer Science (21)
        • Data Science (24)
        • Computer Vision (22)
        • Computer Graphics (1)
        • NLP (15)
        • ETC (4)
      • Error Note (7)
      • ETC (1)
  • 인기 글

  • 최근 글

  • 최근 댓글

  • 태그

    network_mode: "host"
    docker compose
    docker 배포
    unique
    논리적 삭제
    localhost
    단축키
    kotlin linkedlist
    Kotlin
    springboot 배포
    kotlin arraylist
    데이터베이스 제약
    list
    지리 정보
    kotlin mutablelist
    MacOS
    jvm 메모리 누수
  • 링크

    • RaillyLinker Github
  • hELLO· Designed By정상우.v4.10.0
Railly Linker
Springboot Kotlin 에서 @InitBinder 사용하기 (@InitBinder methods must not return a value (should be void): 에러 해결)
상단으로

티스토리툴바