In standard Java EE/Jakarta EE container, in a servlet component, it can inject CDI beans, EJB etc. Spring Boot @ServletComponentScan
improve the servlet registration.
If possible to make this available in Spring WebMvc by default(no need the specific ServletComponentScan, use the standard ComponentScan
to discover servlet components), in all Servlet components(Servlet, Filter, Listeners), make it can inject Spring beans.
Comment From: sbrannen
Hi @hantsy,
Thanks for the proposal.
The @ServletComponentScan
feature was implemented in Spring Boot since Spring Boot starts an embedded Servlet container, and annotations like @WebServlet
, @WebFilter
, and @WebListener
are not supported in embedded containers. So it makes sense to have the @ServletComponentScan
feature in Spring Boot.
However, the Spring Framework's support for Servlet containers is not specific to embedded containers. In other words, Spring Web and Spring MVC do not differentiate between a traditional WAR deployment or embedded deployments. In light of that, we do not feel that it would make sense to implement features analogous to @ServletComponentScan
in the core framework, and I am closing this PR.