Skip to content

Commit

Permalink
Fix Micronaut integration in Helidon 3.x? #7206
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos committed Jan 16, 2024
1 parent d3f7edf commit 5ff4a02
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 81 deletions.
39 changes: 18 additions & 21 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019, 2023 Oracle and/or its affiliates.
Copyright (c) 2019, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -72,7 +72,7 @@
<version.lib.hystrix>1.5.18</version.lib.hystrix>
<version.lib.jackson>2.15.2</version.lib.jackson>
<version.lib.jakarta.activation-api>2.0.1</version.lib.jakarta.activation-api>
<version.lib.jakarta.annotation-api>2.0.0</version.lib.jakarta.annotation-api>
<version.lib.jakarta.annotation-api>2.1.0</version.lib.jakarta.annotation-api>
<version.lib.jakarta.cdi-api>3.0.0</version.lib.jakarta.cdi-api>
<version.lib.jakarta.el-api>4.0.0</version.lib.jakarta.el-api>
<version.lib.jakarta.inject>2.0.0</version.lib.jakarta.inject>
Expand Down Expand Up @@ -106,9 +106,10 @@
<version.lib.mariadb-java-client>2.6.2</version.lib.mariadb-java-client>
<version.lib.maven-wagon>2.10</version.lib.maven-wagon>
<version.lib.micrometer>1.6.6</version.lib.micrometer>
<version.lib.micronaut>3.8.7</version.lib.micronaut>
<version.lib.micronaut.data>3.4.3</version.lib.micronaut.data>
<version.lib.micronaut.sql>4.8.0</version.lib.micronaut.sql>
<version.lib.micronaut>4.2.2</version.lib.micronaut>
<version.lib.micronaut.validation>4.2.0</version.lib.micronaut.validation>
<version.lib.micronaut.data>4.4.1</version.lib.micronaut.data>
<version.lib.micronaut.sql>5.4.0</version.lib.micronaut.sql>
<version.lib.microprofile-config>3.0.1</version.lib.microprofile-config>
<version.lib.microprofile-fault-tolerance-api>4.0</version.lib.microprofile-fault-tolerance-api>
<version.lib.microprofile-graphql>2.0</version.lib.microprofile-graphql>
Expand Down Expand Up @@ -1001,14 +1002,6 @@
<artifactId>micronaut-core</artifactId>
<version>${version.lib.micronaut}</version>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
Expand All @@ -1019,6 +1012,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-core-processor</artifactId>
<version>${version.lib.micronaut}</version>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-aop</artifactId>
Expand Down Expand Up @@ -1086,20 +1084,19 @@
<version>${version.lib.activemq}</version>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
<version>${version.lib.micronaut}</version>
<version>${version.lib.micronaut.validation}</version>
</dependency>
<dependency>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation-processor</artifactId>
<version>${version.lib.micronaut.validation}</version>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-runtime</artifactId>
<version>${version.lib.micronaut}</version>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.micronaut.sql</groupId>
Expand Down
13 changes: 11 additions & 2 deletions examples/integrations/micronaut/data/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2023 Oracle and/or its affiliates.
Copyright (c) 2020, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,6 +44,10 @@
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-runtime</artifactId>
Expand Down Expand Up @@ -118,9 +122,14 @@
</path>
<path>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<artifactId>micronaut-core-processor</artifactId>
<version>${version.lib.micronaut}</version>
</path>
<path>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation-processor</artifactId>
<version>${version.lib.micronaut.validation}</version>
</path>
<path>
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-processor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@

package io.helidon.examples.integrations.micronaut.data;

import javax.validation.ConstraintViolationException;

import jakarta.validation.ConstraintViolationException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,11 +16,10 @@

package io.helidon.examples.integrations.micronaut.data;

import javax.validation.constraints.Pattern;

import io.helidon.examples.integrations.micronaut.data.model.Pet;

import jakarta.inject.Inject;
import jakarta.validation.constraints.Pattern;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.Path;
Expand Down
20 changes: 19 additions & 1 deletion integrations/micronaut/cdi-processor/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2023 Oracle and/or its affiliates.
Copyright (c) 2020, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,22 +34,32 @@
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-core-processor</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

Expand All @@ -62,6 +72,14 @@
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<!-- https://github.com/micronaut-projects/micronaut-core/issues/10299 -->
<plugin>
<groupId>io.helidon.build-tools</groupId>
<artifactId>helidon-services-plugin</artifactId>
<configuration>
<failOnMissingModuleInfo>false</failOnMissingModuleInfo>
</configuration>
</plugin>
</plugins>
</build>
</project>

This file was deleted.

13 changes: 7 additions & 6 deletions integrations/micronaut/cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2023 Oracle and/or its affiliates.
Copyright (c) 2020, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,10 +35,6 @@
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject-java</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
Expand Down Expand Up @@ -116,9 +112,14 @@
</path>
<path>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<artifactId>micronaut-core-processor</artifactId>
<version>${version.lib.micronaut}</version>
</path>
<path>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation-processor</artifactId>
<version>${version.lib.micronaut.validation}</version>
</path>
<path>
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-processor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,6 @@

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Array;
Expand Down Expand Up @@ -208,11 +207,6 @@ private static void processAnnotations(Map<Class<? extends Annotation>, Annotati
Map<Class<? extends Annotation>, Annotation> stereotypeMap,
Map<String, Set<String>> annotationsByStereotype) {
for (var entry : declaredAnnotations.entrySet()) {
if (stereotypeMap.containsKey(Repeatable.class)) {
// I need to ignore this (used only when there is just one repetition)
// this gets processed as part of the Repeatable container
continue;
}
String annotName = entry.getKey().getName();
miAnnotations.put(annotName, annotationValues(entry.getValue()));
Set<Annotation> stereotypes = getStereotypes(entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,8 +21,28 @@
@ApplicationScoped
@MicronautBeanDef
public class TestBothBean implements TestBean {

@Override
public String name() {
return "BothBean";
}

@CdiIntercepted
@Override
public String cdiAnnotated() {
return TestBean.super.cdiAnnotated();
}

@MicroIntercepted
@Override
public String µAnnotated() {
return TestBean.super.µAnnotated();
}

@CdiIntercepted
@MicroIntercepted
@Override
public String bothAnnotated() {
return TestBean.super.bothAnnotated();
}
}
15 changes: 12 additions & 3 deletions integrations/micronaut/data/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2023 Oracle and/or its affiliates.
Copyright (c) 2020, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,6 @@
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -59,6 +58,11 @@
<artifactId>micronaut-runtime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
Expand Down Expand Up @@ -151,9 +155,14 @@
</path>
<path>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<artifactId>micronaut-core-processor</artifactId>
<version>${version.lib.micronaut}</version>
</path>
<path>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation-processor</artifactId>
<version>${version.lib.micronaut.validation}</version>
</path>
<path>
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-processor</artifactId>
Expand Down
Loading

0 comments on commit 5ff4a02

Please sign in to comment.