Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] Make Servlets CDI beans?

Arjan,

I think better defined integration between servlets and CDI is highly desirable.   

However, there is still a really vague area of the difference between webapps that bundle their own version of CDI and expect to be able to use that internally, vs a CDI implementation provided by the container.      This really needs to be sorted out and clarified as dealing with multiple versions of the CDI API is a bit of a nightmare (especially with JPMS).

So if we are to continue to allow webapps to bundle CDI within themselves, should we really be looking at adding something to the Servlet spec to allow arbitrary decoration of container managed instances by entities on either in the container and/or in the webapp.
This mechanism could then be instantiated by CDI implementations and thus decorate Listeners/Filters/Servlets.

Or maybe CDI is this mechanism, but then it really needs to sort out how to handle the difference between in webapp and in container injection. Specifically different versions of CDI.

Finally,  we need to ensure that CDI decoration is specified either as something to initialize instances before they are configured by descriptors/fragments/annotations/listeners; or as overrides that apply after instances are configured by descriptors/fragments/annotations/listeners.    Sorting out the precedence amongst these configuration sources is already a nightmare, having an additional one in the mix will not be good... especially for anything that tries to make an effective-web.xml to fast start a webapp without scanning.  CDI injection needs to be applied before or after an effective-web.xml... never during!

cheers














On Wed, 8 Nov 2023 at 02:57, Arjan Tijms via servlet-dev <servlet-dev@xxxxxxxxxxx> wrote:
Hi,

This was discussed a while ago, but in the context of the CDI-centric Jakarta EE release it might be good to restart this discussion.

The overall goal of the Jakarta EE platform is to move the various spec specific component models and mechanisms to CDI (as per the "CDI-centric" theme).

Servlets have been @Inject injectable (loosely via the pruned Managed Beans spec, although the Servlet spec itself did not say so), but are themselves not CDI beans.

I'd like to propose to make Servlets officially CDI beans, but only within a Jakarta EE environment.

Meaning, Tomcat and Jetty would have no requirement to support this, and these requirements would be in a separate chapter of the Servlet spec.

Thoughts?

Kind regards,
Arjan Tijms
_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/servlet-dev


--

Back to the top