Skip to content

Commit

Permalink
feat(node-notifier): supports both javax and jakarta Inject annotation
Browse files Browse the repository at this point in the history
Upgrading gravitee-plugin to 2.0.0 brings an updated gravitee-node-api
which does not declare javax.inject dependencies anynore. This prevented
the compilation of the gravitee-node-notifier module.

This commit adds the javax.inject dependency to fix the compilation. It
also supports the new annotation comming from Jakarta.
  • Loading branch information
jgiovaresco committed Jul 17, 2023
1 parent 2cee899 commit a909bff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions gravitee-node-notifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,27 @@
<artifactId>gravitee-node-notifier</artifactId>
<name>Gravitee.io - Node - Notifier</name>

<properties>
<javax-inject.version>1</javax-inject.version>
<jakarta-inject.version>2.0.1</jakarta-inject.version>
</properties>

<dependencies>
<dependency>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>${javax-inject.version}</version>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>${jakarta-inject.version}</version>
</dependency>

<dependency>
<groupId>io.gravitee.plugin</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private Constructor<? extends Notifier> lookingForConstructor(Class<? extends No
}

private Set<Field> lookingForInjectableFields(Class<?> resourceClass) {
return ReflectionUtils.getAllFields(resourceClass, withAnnotation(Inject.class));
return ReflectionUtils.getAllFields(resourceClass, withAnnotations(Inject.class, jakarta.inject.Inject.class));
}

public static Predicate<Member> withParametersAssignableFrom(final Class... types) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
<properties>
<gravitee-bom.version>6.0.1</gravitee-bom.version>
<gravitee-common.version>2.1.1</gravitee-common.version>
<gravitee-plugin.version>2.0.0-alpha.3</gravitee-plugin.version>
<gravitee-plugin.version>2.0.0</gravitee-plugin.version>
<gravitee-reporter-api.version>1.25.0</gravitee-reporter-api.version>
<gravitee-tracing-api.version>1.0.0</gravitee-tracing-api.version>
<gravitee-kubernetes.version>2.0.3</gravitee-kubernetes.version>
Expand Down

0 comments on commit a909bff

Please sign in to comment.