[cdi-dev] [servlet-spec users] [jsr369-experts] [116-CDIRelatedBeansInServletSpec] PROPOSAL

Mark Struberg struberg at yahoo.de
Thu Nov 20 08:47:19 EST 2014

I'm not quite sure that it's worth it. The @RequestScoped and @SessionScoped are already in the CDI spec package. And as you know we must not split packages between different specs.

It would feel quite unnatural to have annotations in the CDI APIs but the description in the servlet spec. Also note that some of those scopes (mostly @RequestScoped) also get used for non-servlet tasks. E.g. java-concurrency-utils threads, @Asynchronous EJBs, JMS invocations, @PostConstruct of @Stateless @Startup beans, etc.

What we probably could add (regardless whether on CDI or Servlet side) is kind of a @WebAppScoped. This is really missing atm. But again this must also be active in e.g. JMS invocations which form kind a 'logical app'. 


> On Wednesday, 19 November 2014, 19:40, Edward Burns <edward.burns at oracle.com> wrote:
> > Hello Volunteers,
> The Servlet spec PDF currently only mentions CDI on two pages (and one
> of them is a reference to the other).  It appears the normative
> declaration of the requirements in Servlet regarding CDI is in our
> section 15.5.15 "Contexts and Dependency Injection for Java EE
> requirements".
> The CDI spec is trying to trim itself down and part of that effort
> requires fobbing off some requirements previously declared in the CDI
> spec itself to other related specs.  In this case, we have the
> following:
> CDI Spec section 3.8 [1] places some requirements on CDI implementations
> when running with Servlet. To better suit user desires for modularity
> these requirements are better met by moving them to the Servlet
> spec. Specifically,
> CDI3.8>    A servlet container must provide the following built-in
> CDI3.8>    beans, all of which have qualifier @Default:
> CDI3.8>    a bean with bean type javax.servlet.http.HttpServletRequest,
> CDI3.8>    allowing injection of a reference to the HttpServletRequest
> CDI3.8>    a bean with bean type javax.servlet.http.HttpSession,
> CDI3.8>    allowing injection of a reference to the HttpSession,
> CDI3.8>    a bean with bean type javax.servlet.ServletContext, allowing
> CDI3.8>    injection of a reference to the ServletContext,
> CDI3.8>    These beans are passivation capable dependencies, as defined
> CDI3.8>    in Passivation capable dependencies.
> To put these items in the Servlet spec, we may have to couch them in
> terms similar to, "when running in an environment that also supports
> CDI...".
> Include language in our spec section 15.5.15 which allows the CDI spec
> to remove their language while preserving desired existing user
> functionality.
> What do you all think?  I know several of our constituents do not count
> CDI support among their user requirements.  Is this going to be a
> problem?
> Ed
> [1] http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#additional_builtin_beans
> -- 
> | edward.burns at oracle.com | office: +1 407 458 0017

More information about the cdi-dev mailing list