helidon-io / helidon

Java libraries for writing microservices
https://helidon.io
Apache License 2.0
3.52k stars 564 forks source link

Fix Micronaut integration #7206

Open tjquinno opened 1 year ago

tjquinno commented 1 year ago

Environment Details


Problem Description

Micronaut has just released 4.0 (11 July 2023) which, among other things, has breaking changes regarding javax vs. jakarta in some areas including validation, as described in this excerpt from Slack:

I'm having issue of imcompatibilty of the jakarta.validation and javax.validation. The jakarta.validation (I'm refering to the constraints import jakarta.validation.constraints.* in to the model) doesn't work with micronaut @Validated in CrudRepository as it does not trigger the validation due the helidon.integrations.micronaut it only supportjavax.validation instead (tested it work).

version.lib.micronaut>3.4.3</version.lib.micronaut>, 
version.lib.micronaut.data>3.3.0</version.lib.micronaut.data>  

However with the use of javax.validation.* it create issue for manual validation, the Validation.buildDefaultValidatorFactory()doest work withjavax, which trigger the error.

[helidon-server-1] ERROR xxx.GlobalExceptionHandler - Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.  
javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

As Micronaut 4.0 contains breaking changes from Micronaut 3.x, we probably would not want to change the Micronaut dependency to 4.0 in a Helidon 3.x dot release (as the original poster in Slack inquired about).

But do we want to consider updating the Micronaut dependency to 4.0 in Helidon 4.x?

jbescos commented 1 year ago

I am verifying this with Micronaut 4.1.0 in Helidon 4.x

It still depends on javax, for example io.micronaut.annotation.processing.TypeElementVisitorProcessor contains the next imports:

import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedOptions;

But in Helidon we have jakarta.annotation:jakarta.annotation-api:jar:2.1.1 that uses the package names with jakarta. I think we cannot integrate Micronaut 4x yet.

ASoftwareProgramer commented 1 year ago

These are JAVA JDK java.compiler library, would this impact the integration ? I believe these namespace will not be change for the JAVA platform.

romain-grecourt commented 1 year ago

These are JAVA JDK java.compiler library, would this impact the integration ? I believe these namespace will not be change for the JAVA platform.

Correct, jakarta.annotation:jakarta.annotation-api:jar:2.1.1 is not the replacement of javax.annotation.processing.

ASoftwareProgramer commented 10 months ago

Hi All,

I would like to know when will this fix to be release, any expected date ?

ASoftwareProgramer commented 7 months ago

Hi All,

Any expected date to be release the Micronut integration fix ?

jbescos commented 7 months ago

Hi All,

Any expected date to be release the Micronut integration fix ?

There is a PR but it is pending to be reviewed. I think we will know the date once it is approved and merged.