[Spring] Parameter name information not available via reflection 에러

아뵤·2024년 11월 7일
0

Algorithm/Java

목록 보기
5/5

java.lang.IllegalArgumentException: Name for argument of type [java.lang.Long] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.

매개변수 이름 인식 에러로 꽤나 고생을 함....

서치해 보면 gradle에 --parameter sev-dev 인가? 추가하라는 내용도 나오는데 해결이 안 됨

그러나 간단히 해결 가능하다!

@PathVariable

public String mappingPath(@PathVariable("userId") String userId) {
    ...
}
public String mappingPath(@PathVariable(name="userId") String userId) {
    ...
}

name="" 형식으로 구체적으로 지정해 주니 해결됨 으으 분해!

@RequestParam, @PathVariable, @Autowired, @ConfigurationProperties

등 어노테이션 사용 시에도 같은 에러가 잘 나타난다고 한다.

조금 더 주의해서 사용하자

왕초보는 머든 다 어렵다...

참고
스프링 부트 3.2 매개변수 이름 인식 문제

profile
헤매는 만큼 내 세상 🌟🌠

0개의 댓글