You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[spring framework 7] add validation + quickfixes to identify new BeanRegistrars that are not imported #1499
for every class that implements BeanRegistrar, there should be an @Import(..) for that class in some configuration
quick fix should allow users to add this @Import to existing configuration classes, or create a new configuration class with that @Import
difficulty might be that a config class already has an @Import annotation, in which case the bean registrar type should be added to that @Import annotation for that config class
As expected now there are issues observed once the quick fix is applied since there is nothing to kick off re-validation... I'm thinking of adding dependency files for BeanRegistrar bean files. Namely, I'm thinking of configuration bean resources to be dependencies of BeanRegistrar resources. Consequently a change in configuration bean resource would trigger re-indexing and re-validation of the BeanRegistrar resource
I have tested this with the latest from main, but I see a lot of false positives here.
I have a BeanRegistrar implementation that is imported, and there is no warning showing up (correct)
I have another BeanRegistrar implementation that is NOT imported anywhere and there is a warning showing up (correct)
All other classes in that project also show up a warning about not being registered, even through they don't implement BeanRegistrar at all. Creating a plain simple new Java class immediately shows the warning - wich is definitely not correct.
Activity
GH-1499: added demo code to find config beans with imports for a cert…
GH-1499: added demo code to find config beans with imports for a cert…
BoykoAlex commentedon Mar 17, 2025
@martinlippert I have pushed 7df37a3.
As expected now there are issues observed once the quick fix is applied since there is nothing to kick off re-validation... I'm thinking of adding dependency files for BeanRegistrar bean files. Namely, I'm thinking of configuration bean resources to be dependencies of BeanRegistrar resources. Consequently a change in configuration bean resource would trigger re-indexing and re-validation of the BeanRegistrar resource
martinlippert commentedon Mar 19, 2025
I have tested this with the latest from
main, but I see a lot of false positives here.BeanRegistrarimplementation that is imported, and there is no warning showing up (correct)BeanRegistrarimplementation that is NOT imported anywhere and there is a warning showing up (correct)BeanRegistrarat all. Creating a plain simple new Java class immediately shows the warning - wich is definitely not correct.GH-1499: do not check bean registrar imports when it is not a bean re…
GH-1499: add additional indexing logic to allow additional reconcilin…
GH-1499: re-validating bean registrars now when config classes change…