How does this help me build maintainable software?
Spring and Spring Boot (and similar frameworks) provide a lot of features that make our lives easier. One of the main features is assembling the application out of the parts (classes) that we, as application developers, provide.
Classpath scanning is a very convenient feature. We only have to point Spring to a package and it assembles an application from the classes it finds. This allows for rapid development, with us not having to think about the application as a whole.
Once the code base grows, however, this quickly leads to a lack of transparency. We don’t know which beans exactly are loaded into the application context. Also, we cannot easily start up isolated parts of the application context to use in tests.
By creating a dedicated configuration component responsible for assembling our application, we can liberate our application code from this responsibility (read: “reason for change” – remember...