-
Notifications
You must be signed in to change notification settings - Fork 510
Description
I'm trying to test a FeignClient where I've defined a PathVariable using a @PathVariable String urlId but I'm receiving a PathVariable annotation was empty on param 0 when I attempt to run my tests. It works via a gradlew test but not in the VS Code test runner. I can resolve this by explicitly mapping @PathVariable(value = "urlId") String urlId but the documentation defines that as an optional field (https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/PathVariable.html).
I believe this is something related to the compiler, because gradlew test and IntelliJ can run the tests without the explicit mapping, but it only fails with the error in the VS Code test extension. Reading the spring docs it calls out in the input mapping that if it's compiled with the -parameters flag it will map the input to the method's parameters (https://docs.spring.io/spring-boot/reference/actuator/endpoints.html#actuator.endpoints.implementing-custom.input). I was able to successfully validate this in VS Code by going to the Java > Settings: Url and pointing it to a new settings.pref file I created that only contains the line org.eclipse.jdt.core.compiler.codegen.methodParameters=generate, which allowed the compiler to map without the explicit (value = "urlId") on the annotation. I'm not a huge fan of this approach however, because I'm positive I'm going to forget this every time I setup a new device, so I was wondering if this constituted an issue that could be rolled into the extension so this was supported without having to create a custom settings file any time I need to test a spring project with feign client.
For additional system details I'm running spring boot 3.4.1, with a gradle build it, on Java 21.0.6 (Amazon Corretto 21) on the Java Language Support extension version 1.41.0 (temporarily downgraded from 1.41.1 due to #4002)