I finally found the problem. I was using the wrong import.
org.springframework.http.HttpMethod.GET
did the trick. jakarta.ws.rs.HttpMethod.GET returned a string that was evaluated as pattern.