Philippe Marschall opened SPR-10354 and commented

These days every container has to do component scanning because more or less every EE specification — even servlets — requires the application server to discover classes annotated in a special way.

Since the application server controls the class loaders and deployments it's able to do so in an a reliable, stable and possibly more performant way compared to Spring. As application severs are beginning to fight over start up performance this an area that receives a lot of attention. Some like JBoss even go so far as to allow you to provide an index build at compile time to speed this up even further.

As Spring has always been about taking advantage of services provided by applications servers in a portable way that doesn't lock you in I think you would be a great feature.


Issue Links: - #16509 Spring-specific index file for component candidate classes

0 votes, 5 watchers

Comment From: spring-projects-issues

Juergen Hoeller commented

Jandex (now at https://github.com/wildfly/jandex) is still the most common option here. An alternative would be ClassIndex (https://github.com/atteo/classindex).

We could consider such an index file as an explicit hint to Spring's component scanning, parsed through specific Jandex etc adapters. While this wouldn't be completely transparent e.g. simply through running on WildFly, it would at least allow for reusing an existing application server index. More importantly, it would also allow for building custom applications with a common index file that can be understood by Spring as well as Hibernate ORM and others...

Comment From: jhoeller

With spring-context-indexer and AOT processing, it looks externally provided annotation scanning is not in demand anymore, in particular not in a Spring Boot environment.