Closed hohwille closed 3 years ago
BTW: The scopes however like @SessionScoped
or @ConversationScoped
supported by quarkus are IMHO rather to be considered deprecated as JSF and stateful backend with presentation logic are completely outdated.
https://quarkus.io/blog/quarkus-dependency-injection/ quote:
The CDI API is built on top of javax.inject so that it should be easy to migrate from any DI framework compatible with @Inject
So for me it is confusing why then quarkus does not support javax.inject.Named
that comes from the same JSR and package as javax.inject.Inject
.
Anyhow the consequence is that instead of javax.inject.Named
one has to use javax.enterprise.context.ApplicationScoped
to make it work in quarkus. Not a big deal for a new project, but quite a pointless difference for our documentation in devonfw where we then have to say "in quarkus use javax.enterprise.context.ApplicationScoped whereas in spring use javax.inject.Named" the same applies for CobiGen Templates etc.
So if someone knows some kind of config option or quarkus addon that would make javax.inject.Named
behave exactly like javax.enterprise.context.ApplicationScoped
would make our lives easier.
https://quarkus.io/guides/cdi-integration quote:
The resulting list will contain @Named synthetic beans.
Whatever that means. I still can not find any rationale from quarkus.
Maybe it is even easier to make devon4j / spring support javax.enterprise.context.ApplicationScoped
and make that the new default.
I stumbled over this: https://stackoverflow.com/questions/5415261/what-is-javax-inject-named-annotation-supposed-to-be-used-for quote:
This package provides dependency injection annotations that enable portable classes, but it leaves external dependency configuration up to the injector implementation.
I confirmed this here: https://download.oracle.com/otndocs/jcp/dependency_injection-1.0-final-oth-JSpec/index.html
The JSR330 defines the @Named
annotation but misses to explain its semantic. JEE is a mess.
With PR https://github.com/devonfw/devon4j/pull/421 I proposed to update devon4j dependency injection guide. It should then fit for both quarkus and spring: https://github.com/hohwille/devon4j/blob/feature/420-d4q-coding/documentation/guide-dependency-injection.asciidoc
When we merge that PR we could also close this issue.
Done.
The standard in devon4j for components and dependency-injection is following JEE standards that have been established for years and supported by major frameworks like spring, guice, weld, any JEE app server, etc.: https://github.com/devonfw/devon4j/blob/master/documentation/guide-dependency-injection.asciidoc
However, quarkus for some odd reasons does not seem to support
@Named
: https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#bean_defining_annotationsDoes anybody know the rationale for this decision in quarkus? This seems really odd to me and will be a huge drawback when moving "devon4j experienced developers" to quarkus.