So far, we have seen how to define the configuration with XML and annotation. Spring also supports defining configuration completely in Java classes, and there is no more XML required. You need to provide Java classes that take the ownership of creating the beans. In short, it's a source of bean definition.
A class annotated by @Configuration would be considered as Java config for a Spring IoC container. This class should declare methods that actually configure and instantiate the objects of beans that would be managed by containers. All such methods should be annotated with @Bean. Spring will consider all such @Bean annotated methods as a source of bean. Such methods are kinds of factory methods. Let's understand ...