users@javaee-spec.java.net

[javaee-spec users] [jsr342-experts] Re: custom injection annotations

From: Yoon Kyung Koo <kyungkoo_yoon_at_tmax.co.kr>
Date: Tue, 6 Nov 2012 11:40:37 +0900

I prefer the CDI annotation @Inject.
In the view of Java EE customers, @BatchContext can be a little confusing.
I think CDI should be the basis of the Java EE injections.

If the Batch JSR is not dependent upon Java EE platform, it can be a problem, but IMHO the custom injection annotations should not be recommended by JSRs under Java EE platform.

-- 
--------------------
 Software Innovation Evangelist
 Researcher & Executive Director / WAS Lab / TmaxSoft R&D Center
 PGP  http://www.javadom.com/personal/yoonforhatgmaildotcom.asc
2012. 11. 6.,  9:10, Bill Shannon <bill.shannon_at_oracle.com> ۼ:
> 
> I'd like to follow up on an issue we raised at the Java EE 7 BOF
> about the use of custom injection annotations.
> 
> For example, should the Batch spec define
> 
> 	@BatchContext
> 	private JobContext ctx;
> 
> or should it use
> 
> 	@Inject
> 	private JobContext ctx;
> 
> The former is effectively a custom injection annotation unrelated to CDI.
> 
> The latter introduces a dependency on CDI.
> 
> 
> In your opinion, which is preferred?  It seemed that the EE 7 BOF audience was
> pretty evenly split on this one, and I can see arguments for either position.
> 
> If @Inject is preferred, should we allow custom annotations at the discretion
> of the spec author, or should we disallow custom annotations entirely?
> 
> If custom injection annotations are allowed, should CDI make it easy to
> define them, e.g., using something like:
> 
> @Stereotype
> @Inject
> public @interface BatchContext { }
> 
> If CDI supported this easily, applications could even define their own
> injection annotations.
> 
> Should custom injection annotations be a legacy artifact that we need
> to continue to support, or should we recognize it as a part of the
> Java EE programming model and use it widely?