IMO, the @Context annotation allows an SCA Java component to receive injection of some contexts which cannot be modeled as a regular @Reference. In my use cases, I would like to be able to do something like:
@Context private ServletContext servletContext; // My component is running as part of the web application @Context private ApplicationContext appContext; // My component needs to access some Spring information @Context private JAXBContext jaxbContext; // My component needs to do JAXB marshaling The strong-typed context is clearly better than weakly-typed one from Java programming perspective. It also make the runtime easily to understand the requirements for specific context injection and implement context providers to support it. Thanks, Raymond ________________________________________________________________ Raymond Feng rf...@apache.org Apache Tuscany PMC member and committer: tuscany.apache.org Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com Personal Web Site: www.enjoyjava.com ________________________________________________________________ On Jul 15, 2011, at 11:45 AM, Mike Edwards wrote: > Raymond, > > Can you explain why you prefer strobgly types context extensions? > > Why is this JAX-RS mechanism a good thing? > > Can you paint a picture of what this would look like: > > a) for the application components > b) for the runtime/binding components > > > Yours, Mike. > > On 15/07/2011 17:35, Raymond Feng wrote: >> I prefer to have strongly-typed context extensions. JAX-RS has the similar >> mechanism to allow custom >> context to be injected via @Context. The context can be resolved via: >> >> *http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/ContextResolver.html* >> * >> * >> *Thanks,* >> *Raymond >> * >