In the early days of the Spring Framework, all configuration for the application context was specified in XML files. However, with the evolution of annotations from Java 5, present-day applications use Java configurations based on annotations. In this book, we will use a Java annotation-based configuration for most examples.
We will start with an example of a Java annotation-based configuration. In a later section, we will see an example of an XML-based configuration.
The following example shows you how to create a simple Java context configuration:
@Configuration
class SpringContext {
}
The key is the @Configuration annotation. This is what defines this as a Spring configuration.