I'm encountering an issue with Spring Boot. Recently, I upgraded the Spring Boot dependency to version 3.2.4.
When I attempt to call the following endpoint:
@PutMapping("/{uid}/test/{state}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void update(
Context context,
@PathVariable String uid,
@PathVariable String state
) throws RuntimeFunctionalException {
this.service.updateState(uid, state, context);
}
Output:
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
Is anyone else facing the same issue?
To fix the problem, add name for @RequestParam and @PathVariable annotations.
So, instead of this:
public ResponseEntity<CommandResponse> update(
@PathVariable long param1,
@RequestParam String param2) {
// ...
}
use this >>>
public ResponseEntity<CommandResponse> update(
@PathVariable("param1") long param1,
@RequestParam("param2") String param2) {
// ...
}
Please include this configuration in your POM file
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
this configuration is important <parameters>true</parameters>
For more details use this link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With