
Front-end : NextJS
Back-end : Spring boot, Spring Security
상황 :
개인 프로젝트인 콘서트 예매 서비스를 진행하면서
로그인을 Spring security + JWT 로 적용해보고자함.
기존 next-auth를 우선 걷어내고 적용하고있었음.
403의 밭에서 한창 리팩토링 하는중에....
java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.
Java 컴파일러가 메서드의 파라미터 이름을 유지하지 못해서 발생
@Operation(summary = "유저 예약 내역 요청")
@GetMapping("/{userId}/reservations")
public Response<ReservationListResponseDTO> getUserReservation (@PathVariable String userId) {
...
}
// maven (pom.xml)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
//gradle (build.gradle)
compileJava {
options.compilerArgs << '-parameters'
}
Gradle 빌드 스크립트에서 compileJava 작업(Task)에 대해 추가적인 컴파일러 옵션을 설정하는 방법
IntelliJ를 사용한다면 Settings에서도 설정이 가능하다.

public Response<ReservationListResponseDTO> getUserReservation (@PathVariable(value="userId") String userId) {
이처럼 수정해서 에러를 해결했다 !