I am learning about the Spring Framework but I can't understand what exactly the @Configuration annotation means and which classes should be annotated so. In the Spring Boot docs it is said that the Application class should be @Configuration class.
Spring Boot favors Java-based configuration. Although it is possible to call SpringApplication.run() with an XML source, we generally recommend that your primary source is a @Configuration class.
Trying to learn about @Configuration I find that annotating a class with the @Configuration indicates that the class can be used by the Spring IoC container as a source of bean definitions.
If that is so then how is this application class a source of bean definitions?
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan
public class App
{
public static void main(String[] args) throws Exception {
SpringApplication.run(App.class, args);
}
}
I have pretty much understood most other basic concepts regarding Spring but I can't understand the purpose of @Configuration or which classes should be @Configuration classes? Can someone please help. Thanks !!