Configuring the Spring application context
Traditionally, we would use declarative configuration with XML configuration files, but after Spring Framework 3.0 was released, it has been possible to configure the Spring application context by using programmatic configuration. This is our weapon of choice when we are configuring the application context of our application.
We can configure the Spring application context by following these steps:
Create a properties file for the values of the configuration parameters.
Create the application context configuration class.
Creating the properties file
The actual values of the configuration parameters are stored in a properties file called application.properties
. This file contains database connection details, Hibernate configuration, and the base package of our entities. The content of this file is as follows:
#Database Configuration db.driver=org.h2.Driver db.url=jdbc:h2:mem:datajpa db.username=sa db.password= #Hibernate Configuration hibernate.dialect...