February 2019
Intermediate to advanced
442 pages
11h 46m
English
We will define the JDBC connection properties in an application.properties file and place it in src/main/resources. The properties we define are as follows:
dataSourceClassName=com.mysql.jdbc.DriverjdbcUrl=jdbc:mysql://localhost:3306/worldgdpdataSource.user=rootdataSource.password=test
The preceding properties are with the assumptions that MySQL is running on port 3306 and the database username and password are root and test respectively. You can change these properties as per your local configuration. The next step is to define a properties resolver that will be able to resolve the properties when used from within the code. We will use the @PropertySource annotation, along with an instance of PropertySourcesPlaceholderConfigurer ...