You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by "John D. Ament" <jo...@apache.org> on 2016/05/01 17:16:00 UTC

Why is @Config a qualifier

Hey guys

I was wondering, why is the annotation Config a qualifier?
https://github.com/apache/incubator-tamaya/blob/master/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java

It seems out of place.  Injection as I understand it is a way to provide a
typesafe impl of a configuration object at runtime.  There are separate
modules for CDI that handle injection into CDI beans, and the provider of
this annotation is in CDI so I'm not sure why its an injection
requirement.  If the intention was to have a single annotation represent
both the typesafe objects and CDI beans that makes sense, but then it
probably shouldn't be a qualifier.  We can update the CDI extension to look
for fields with @Config and add a qualifier to them that can be processed
at runtime.

John

Re: Why is @Config a qualifier

Posted by Anatole Tresch <at...@gmail.com>.
Hi all

the annots were taken over from the TomEE code base. I am not sure, if the
qualifier meta-annot was already there, I dont assume, but I can have a
look at it later...
AFAIK I dont see any reason for the qualifier meta-annot. The multiple
names are left-overs from our several discussions on annotation namers.
CUrrently there is one single annotation API package, applied to all
variants of injection runtime adaptions...

J Anatole


2016-05-01 17:29 GMT+02:00 Werner Keil <we...@gmail.com>:

> Not sure, what happened to those annotations, especially JavaDoc looks
> quite inconsistent or outdated
>
> {@code
> // * pubic class ConfiguredItem{
> // *
> // * @ConfiguredProperty
> // * private String aValue;
> // * }
>
> There is no @ConfiguredProperty, maybe @Config was supposed to take its
> place.
>
> In an internal heavily CDI-based framework a recent client had developed,
> they did also apply something like @Configured or @Configurable, so which
> ever way the annotation is called or improved, it should be there, at least
> as an optional module or in the core API.
>
> Regards,
> Werner
>
>
>
> On Sun, May 1, 2016 at 5:16 PM, John D. Ament <jo...@apache.org>
> wrote:
>
> > Hey guys
> >
> > I was wondering, why is the annotation Config a qualifier?
> >
> >
> https://github.com/apache/incubator-tamaya/blob/master/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java
> >
> > It seems out of place.  Injection as I understand it is a way to provide
> a
> > typesafe impl of a configuration object at runtime.  There are separate
> > modules for CDI that handle injection into CDI beans, and the provider of
> > this annotation is in CDI so I'm not sure why its an injection
> > requirement.  If the intention was to have a single annotation represent
> > both the typesafe objects and CDI beans that makes sense, but then it
> > probably shouldn't be a qualifier.  We can update the CDI extension to
> look
> > for fields with @Config and add a qualifier to them that can be processed
> > at runtime.
> >
> > John
> >
>



-- 
*Anatole Tresch*
Java Engineer & Architect, JCP Star Spec Lead
*Switzerland, Europe Zurich, GMT+1*

*Blogs: **http://maketechsimple.wordpress.com
<http://maketechsimple.wordpress.com/> *
*Twitter:  @atsticks*

Re: Why is @Config a qualifier

Posted by "John D. Ament" <jo...@apache.org>.
The way I was thinking to fix this was to continue to look for @Config (or
whatever name it should have) but add an annotation to it dynamically on
the injection point.  Then change the producer method to look for that
annotation to decouple the two.

The reason I bring this up, when looking at OSGi support, it came up that
CDI was a required asset.  I was able to work around it for now, but
realistically to run the non-CDI based components I shouldn't need to list
CDI as a dependency.

John

On Sun, May 1, 2016 at 11:29 AM Werner Keil <we...@gmail.com> wrote:

> Not sure, what happened to those annotations, especially JavaDoc looks
> quite inconsistent or outdated
>
> {@code
> // * pubic class ConfiguredItem{
> // *
> // * @ConfiguredProperty
> // * private String aValue;
> // * }
>
> There is no @ConfiguredProperty, maybe @Config was supposed to take its
> place.
>
> In an internal heavily CDI-based framework a recent client had developed,
> they did also apply something like @Configured or @Configurable, so which
> ever way the annotation is called or improved, it should be there, at least
> as an optional module or in the core API.
>
> Regards,
> Werner
>
>
>
> On Sun, May 1, 2016 at 5:16 PM, John D. Ament <jo...@apache.org>
> wrote:
>
> > Hey guys
> >
> > I was wondering, why is the annotation Config a qualifier?
> >
> >
> https://github.com/apache/incubator-tamaya/blob/master/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java
> >
> > It seems out of place.  Injection as I understand it is a way to provide
> a
> > typesafe impl of a configuration object at runtime.  There are separate
> > modules for CDI that handle injection into CDI beans, and the provider of
> > this annotation is in CDI so I'm not sure why its an injection
> > requirement.  If the intention was to have a single annotation represent
> > both the typesafe objects and CDI beans that makes sense, but then it
> > probably shouldn't be a qualifier.  We can update the CDI extension to
> look
> > for fields with @Config and add a qualifier to them that can be processed
> > at runtime.
> >
> > John
> >
>

Re: Why is @Config a qualifier

Posted by Werner Keil <we...@gmail.com>.
Not sure, what happened to those annotations, especially JavaDoc looks
quite inconsistent or outdated

{@code
// * pubic class ConfiguredItem{
// *
// * @ConfiguredProperty
// * private String aValue;
// * }

There is no @ConfiguredProperty, maybe @Config was supposed to take its
place.

In an internal heavily CDI-based framework a recent client had developed,
they did also apply something like @Configured or @Configurable, so which
ever way the annotation is called or improved, it should be there, at least
as an optional module or in the core API.

Regards,
Werner



On Sun, May 1, 2016 at 5:16 PM, John D. Ament <jo...@apache.org> wrote:

> Hey guys
>
> I was wondering, why is the annotation Config a qualifier?
>
> https://github.com/apache/incubator-tamaya/blob/master/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java
>
> It seems out of place.  Injection as I understand it is a way to provide a
> typesafe impl of a configuration object at runtime.  There are separate
> modules for CDI that handle injection into CDI beans, and the provider of
> this annotation is in CDI so I'm not sure why its an injection
> requirement.  If the intention was to have a single annotation represent
> both the typesafe objects and CDI beans that makes sense, but then it
> probably shouldn't be a qualifier.  We can update the CDI extension to look
> for fields with @Config and add a qualifier to them that can be processed
> at runtime.
>
> John
>