You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Łukasz Lenart <lu...@googlemail.com> on 2011/07/08 13:11:23 UTC

Rename @Inject to @StrutsInject

Hi,

I was going to call for a Vote over bringing CDI plugin to trunk, but
CDI spec already contains @Inject annotation, can be confusing for the
developers. My idea is to rename current @Inject annotation to
@StrutsInject and then move CDI to trunk.

WDT ?


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Dave Newton <da...@gmail.com>.
On Fri, Jul 8, 2011 at 12:53 PM, Wes Wannemacher <we...@wantii.com> wrote:
> A while back, I remember Don Brown mentioning that it is a good idea
> to keep the IoC/DI of the framework separate from the IoC/DI available
> for users. I agree with this sentiment.

I'm not sure about that, although I see the point... I'm just not
convinced that creating what's ultimately an artificial distinction
between the two really serves any purpose, and it creates a need to
understand multiple DI systems for those tweaking S2 guts.

 Because of that, i don't think
> I don't think our users are using @Inject in their web-apps.

I'm not convinced that's true, as we've seen questions regarding its
use. People not using Spring may also be using it. I've used it,
although not a lot.

> I think we should build an ObjectFactory that is aware of CDI and allow
> users to register their own container with it.

Yeah, that seems like the answer.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Łukasz Lenart <lu...@googlemail.com>.
Let's close this discussion now, we can come back to it when users
will start to complain ;-)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Łukasz Lenart <lu...@googlemail.com>.
This change can simple lower users' confusion and I suggested it base
on my experience. Sometime ago I was developing application with CDI
and RESTeasy - both have @Produces annotation and it was very annoying
to discover such a mistake during unit tests or even UI tests. It's
silly, but it happened to my teammate also, whom didn't expect an
annotation with the same name.

The problem is more context specific, now users don't use @Inject
because most of them don't know about XWork's @Inject, but when they
will start using CDI, they can be confused seeing two the same
annotations suggested by IDE.

Another thing, XWork's @Inject should be used internally or by plugins
developers and occasionally by end-users, naming it @StrutsInject will
state that clearly.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Rene Gielen <gi...@it-neering.net>.
See inline

Am 08.07.11 19:53, schrieb Wes Wannemacher:
> On Fri, Jul 8, 2011 at 1:35 PM, Paul Benedict <pb...@apache.org> wrote:
>> I would leave it alone. Hibernate has many custom annotations with the
>> same name as JPA annotations... if you need both, one needs to be
>> fully qualified.
>>
> 
> I agree with Paul, one of the benefits of having packages is the
> ability to have classes with the same name. There is no reason to
> change the name of the annotation.
> 

+1

>> As developers prefer CDI over XWork annotations, then Struts' @Inject
>> will fall out of use.
>>
> 
> A while back, I remember Don Brown mentioning that it is a good idea
> to keep the IoC/DI of the framework separate from the IoC/DI available
> for users. I agree with this sentiment. Because of that, i don't think
> we'll see our own @Inject fall out of use, internally. And, I don't
> think our users are using @Inject in their web-apps. If we want to
> properly support CDI for users, I think we should build an
> ObjectFactory that is aware of CDI and allow users to register their
> own container with it. If I remember correctly, someone started that
> in the sandbox?
>

+1 as well. If an "end-user" wants to make use of XWork's @Inject he
would most probably
a) know what and why he is doing
b) not use JSR-330 @Inject in the same class

Just to be clear, @Inject is not part of CDI but of JSR-330
(javax.inject), on which CDI (JSR-299) builds. The JSR-330 API is a
minimalistic jar with AFAIR 3 or 4 annotations definied, which makes it
easy to bind again without worries. That said, it might be an
interesting thought to extend the core object factory to respect
standard @Inject as an alternative to XW's @Inject, unless the CDI
plugin "overrules" with delegating to a fully featured CDI container.

Anyway, I don't see the benefit of such an drastic API change as
renaming one of our core annotations.

- René

> -Wes
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Wes Wannemacher <we...@wantii.com>.
On Fri, Jul 8, 2011 at 1:35 PM, Paul Benedict <pb...@apache.org> wrote:
> I would leave it alone. Hibernate has many custom annotations with the
> same name as JPA annotations... if you need both, one needs to be
> fully qualified.
>

I agree with Paul, one of the benefits of having packages is the
ability to have classes with the same name. There is no reason to
change the name of the annotation.

> As developers prefer CDI over XWork annotations, then Struts' @Inject
> will fall out of use.
>

A while back, I remember Don Brown mentioning that it is a good idea
to keep the IoC/DI of the framework separate from the IoC/DI available
for users. I agree with this sentiment. Because of that, i don't think
we'll see our own @Inject fall out of use, internally. And, I don't
think our users are using @Inject in their web-apps. If we want to
properly support CDI for users, I think we should build an
ObjectFactory that is aware of CDI and allow users to register their
own container with it. If I remember correctly, someone started that
in the sandbox?

-Wes

-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Paul Benedict <pb...@apache.org>.
I would leave it alone. Hibernate has many custom annotations with the
same name as JPA annotations... if you need both, one needs to be
fully qualified.

As developers prefer CDI over XWork annotations, then Struts' @Inject
will fall out of use.

On Fri, Jul 8, 2011 at 12:28 PM, Jeff Black <je...@yahoo.com> wrote:
> Since it is part of XWork would @XInject be more appropriate?  Just asking.
>
>
>
> ________________________________
> From: Łukasz Lenart <lu...@googlemail.com>
> To: Struts Developers List <de...@struts.apache.org>
> Sent: Fri, July 8, 2011 6:11:23 AM
> Subject: Rename @Inject to @StrutsInject
>
> Hi,
>
> I was going to call for a Vote over bringing CDI plugin to trunk, but
> CDI spec already contains @Inject annotation, can be confusing for the
> developers. My idea is to rename current @Inject annotation to
> @StrutsInject and then move CDI to trunk.
>
> WDT ?
>
>
> Kind regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Rename @Inject to @StrutsInject

Posted by Jeff Black <je...@yahoo.com>.
Since it is part of XWork would @XInject be more appropriate?  Just asking.



________________________________
From: Łukasz Lenart <lu...@googlemail.com>
To: Struts Developers List <de...@struts.apache.org>
Sent: Fri, July 8, 2011 6:11:23 AM
Subject: Rename @Inject to @StrutsInject

Hi,

I was going to call for a Vote over bringing CDI plugin to trunk, but
CDI spec already contains @Inject annotation, can be confusing for the
developers. My idea is to rename current @Inject annotation to
@StrutsInject and then move CDI to trunk.

WDT ?


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org