Q: Config files configuration in Spring IDE (STS): should imported XML files be listed as well? There's one thing I never understood after so many years of using Spring IDE and Spring Tool Suite (STS).
I'm using XML configuration files. One file (say "applicationContext.xml") imports other XML files, through the use of:
<import resource="classpath:path/to/otherContextFile.xml" />

In my Eclipse project properties, under Spring | Beans Support, the option "Enable support for <import/> element in configuration files" is enabled.
In the same project properties page, if the list of the configuration files only contains applicationContext.xml, STS is nevertheless able to detect the contents of otherContextFile.xml and parses it correctly.
However, what I see is that if STS performs an autodetection of configuration files, it always adds to that list otherContextFile.xml as well. But adding all the imported configuration files to that list sounds like the option "Enable support for <import/> element in configuration files" is then useless to me. Since I like to keep my project setup clean and tidy, when this happens I usually remove the imported files from that list.
However, every now and then, the automatic scan is triggered (maybe on STS upgrade or I don't know...) and those files are re-added. This makes me think that it might be a better choice to keep them listed anyway...
So, the question is: what is more correct, elegant and efficient (from a performance point of view)? Just list the "root" configuration files or all of them (even the imported ones)? And if the answer is the latter, what's then the point of that option "Enable support for <import/> element in configuration files"?

A: The main purpose of the "Enable support for <import/> element in configuration files" is exactly what you are using it for and what you describe at the beginning of your question. Therefore I think you are using it in the "right" way (from the STS tooling perspective).
The automatic scan should not add those imported files to the list of used Spring config files in the project properties. It does that for specific files only, like Spring Boot application main classes or files that are listed in the web app. I have no idea at the moment why those imported files are added to that list every once in a while. This could be a bug or could be caused because the mechanism finds those files being used somewhere else.
I would love to take a more detailed look, so it would be great if you could create a small sample app that reproduces this behavior and create a GitHub issue for this problem at: https://github.com/spring-projects/spring-ide/issues. Please attach the sample project and a few steps how to reproduce the issue.
In addition to that you can disable the "automatic scanning" per project or for your entire workspace (to quickly get rid of this behavior). You can deactivate specific automatic configs via the project properties (the third tab, next to the list of config files). The "global" disable can be activated in the general "Preferences -> Spring -> Beans Support" and then "Disable Auto Config Detection".
Hope this helps!!!
