Replies: 1 comment 6 replies
-
Please, attach a sample application using Micronaut Framework 3 working and the same 4 with Micronaut Framework 4 showing the regression. @dstepanov any clue? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In micronaut 3 we have the following code working
io.micronaut.http.HttpRequest<?> request = ...
HttpHeaders headers = request.getHeaders();
Optional optionalMyAppId = headers.getFirst("id",
MyAppId.class);
final MyAppId appId = optionalMyAppId.orElse(null);
Where MyAppId is a pojo class:
public final class MyAppId {
private final String value;
private MyAppId(String value) {
this.value = value;
}
}
In micronaut 3, it will get the value of "id" header and use MyAppId.of method to create a MyAppId object.
This code no longer works in micronaut 4. I debugged into the code and found in
micronaut-core/core/src/main/java/io/micronaut/core/convert/DefaultMutableConversionService.java
Line 237 in 0118db9
It will return EmptyAnnotationMetadata and not able to use of method to convert.
Can you advise how to make our original code working?
Beta Was this translation helpful? Give feedback.
All reactions