Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Duplicate scan of @Import annotations when inherited from another annotation [SPR-10918] #15546
I ran into a situation where classes can be scanned twice. It's quite easy to reproduce.
Given an annotation class:
And a configuration class which is annotated with the above:
And the imported class:
You can see that the log message is printed twice. I don't believe this is correct behaviour. After debugging I believe the issue occurs in ConfigurationClassParser.collectImports where the annotation is resolved on AnotherImport as a class and on TestConfiguration as a string. Hence it is placed into the imports HashSet twice. Perhaps we could do the conversion from a String to a class at this stage?
0 votes, 5 watchers
Clancy Kornie commented
Thanks for the fast response. I ran your test and it worked fine. However I wrote a new one which highlights the error. Try this instead:
Phil Webb commented
I tried the updated test but it still succeeds for me. Could you you possible submit a pull request to https://github.com/SpringSource/spring-framework-issues with something that fails?