helidon icon indicating copy to clipboard operation
helidon copied to clipboard

Fix Micronaut integration

Open tjquinno opened this issue 1 year ago • 6 comments

Environment Details

  • Helidon Version: 4.x
  • Helidon SE or Helidon MP
  • JDK version:
  • OS:
  • Docker version (if applicable):

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 support javax.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 with javax, 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?

tjquinno avatar Jul 16 '23 21:07 tjquinno

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.

jbescos avatar Aug 14 '23 11:08 jbescos

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

ASoftwareProgramer avatar Sep 01 '23 05:09 ASoftwareProgramer

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.

romain-grecourt avatar Sep 05 '23 18:09 romain-grecourt

Hi All,

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

ASoftwareProgramer avatar Jan 12 '24 04:01 ASoftwareProgramer

Hi All,

Any expected date to be release the Micronut integration fix ?

ASoftwareProgramer avatar Mar 25 '24 01:03 ASoftwareProgramer

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.

jbescos avatar Mar 25 '24 07:03 jbescos