Creating a Java configuration for the application context

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset