Search code examples
spring-tools-4

What are the consequences of checking "Disable Auto Config Detection" in the Eclipse Spring preferences?


I mean the Eclipse preference under Window|Preferences|Spring|Beans Support "Disable Auto Config Detection".

When this option is not checked, I notice a delay when saving Java files: Building Workspace...

Loading ...ServerApplication or Loading ...DaoConfig

These messages are for Spring Boot main application classes (ServerApplication) or Spring configuration classes with @ComponentScan (DaoConfig) which are located in the workspace. This can take a few seconds, which is a bit annoying.

When I check the above preference option, I don't notice the delay for loading these classes (at least for the Spring Boot main classes).

What are the consequences of disabling Auto Config Detection, e.g. what does this option really do, what functionality do I loose? Any pointers to documentation?

Can I speed up the save process without having to disable Auto Config Detection?


Solution

  • In STS3, the IDE creates an internal model of your Spring application, so that it can display a nice overview of your Spring elements in the Spring Explorer view, provide content-assist in Spring XML config files and more. In order to build up this internal Spring beans model, it needs to know where to start from when building that model. You can define those entry points manually in the properties for each project: Spring -> Beans Support. That preference allows you to define Spring XML config files and/or Spring-annotated configuration classes to be used by the IDE internally to build up that model.

    In addition to that there is a mechanism to detect those files (Spring XML config files and Spring Boot application configuration annotations) automatically, so that you don't need to configure them manually. But the result is the same. Those files/classes end up being configured to be used by the IDE to built this internal model.

    I guess that the delay that you see comes from building this internal beans model - this is at least what the messages indicate that you mentioned.

    So far for the background. You can disable that auto-config mechanism and you don't need to configure those files/classes manually. This will result in the Spring Explorer, for example, not showing anything meaningful for those projects.

    As an alternative and in case you are working mostly with Spring Boot projects, I would strongly recommend to switch to the all-new Spring Tools 4 (also available as a ready-to-use Eclipse distribution). It provides a slightly different set of features and is implemented in a different way, so that it doesn't need the expensive internal bean model creation. You should give it a try. And if you are missing something that you love in STS3 that is not yet part of Spring Tools 4, let us know.