Closed amoscatelli closed 3 years ago
This seems related to: https://github.com/eclipse/jnosql/issues/239
But that was closed without explanation.
Can't say in detail here but keep in mind, Wildfly uses a different REST implementation than Glassfish or Payara, so the Jersey-related issues or steps may not apply at all.
I don't think the rest implementation is relevant, I believe this is a problem related to the CDI implementation and/or bean discovery.
I am investigating more. There is something wrong here, inside KeyValueExtension, that is not working in my case :
<T extends Repository> void observes(@Observes final ProcessAnnotatedType<T> repo) {
Class<T> javaClass = repo.getAnnotatedType().getJavaClass();
if (Repository.class.equals(javaClass)) {
return;
}
if (Arrays.asList(javaClass.getInterfaces()).contains(Repository.class)
&& Modifier.isInterface(javaClass.getModifiers())) {
crudTypes.add(repo.getAnnotatedType().getJavaClass());
}
}
Oh I got it. bean.xml was missing. When beans.xml is missing default scanning is for annotated types only. The interface StringValueRepository is not annotated so to be scanned it requires bean-discovery-mode="all". Sorry for the fuss, it's working now.
p.s. maybe this could be mentioned somewhere in the guide, when in the example you have to create the interface, I believe there should be a warning about enabling the all discovery mode to make it work.
I am using Wildfly 21.0.0 (so I have CDI/Weld as required)
Any combination of
or
Isn't enough to inject
or
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type StringValueRepository with qualifiers @Database
or
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type StringValueRepository with qualifiers @Default
Of course if the Produces method returns a StringValueRepository directly, then it works.
Since this kind of "indirect" injection is mentioned in different parts of jnosql spec/documentation I wonder what I am doing wrong :
http://www.jnosql.org/spec/ http://www.jnosql.org/docs/key-value.html
In Wildfly logs I can read : 19:44:37,453 INFO [org.eclipse.jnosql.mapping.reflection.ClassConverter] (MSC service thread 1-8) Scanned the entity org.visiontech.optoplus.bucket.manager.producer.StringValue loaded with time of 4 ms 19:44:37,619 INFO [org.eclipse.jnosql.mapping.Databases] (MSC service thread 1-8) Found the type KEY_VALUE to metadata KEY_VALUE@dynamodb 19:44:37,686 INFO [org.eclipse.jnosql.mapping.keyvalue.spi.KeyValueExtension] (MSC service thread 1-8) Processing Key-Value extension: 1 databases crud 0 found 19:44:37,686 INFO [org.eclipse.jnosql.mapping.keyvalue.spi.KeyValueExtension] (MSC service thread 1-8) Processing repositories as a Key-Value implementation: []
Little help please ?
Thank you in advance