트러블슈팅

jakarta.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'jakarta.validation.constraints.NotBlank' validating type 'java.lang.Long'. Check configuration for error

everyday-spring 2024. 9. 3. 16:26
public class FollowerCreateDto {

    @Getter
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Request {
        @NotBlank
        private Long followerId;
    }

}

validation을 적용하면서 '@NotBlank'를 추가했는데 오류가 발생했다

@NotBlank 어노테이션은 문자타입에만 사용가능하다

 

숫자타입이기 때문에

@NotBlank -> @NotNull

변경하여 오류를 해결했다

 

public class FollowerCreateDto {

    @Getter
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Request {
        @NotNull
        private Long followerId;
    }

}