Spring Boot will load properties from the application.properties file which resides in the application class path and add them to the Spring Environment.
This post shows how to create multiple JdbcTemplate instances which are bounded to different databases specified in the properties files.
Configure DataSource bean in the Spring configuration class named DbConfig. Using @ConfigurationProperties we could bind the namespace properties to the given DataSource bean.
5. Create an interface for the DAO
Write an abstract method inside the MedicaidDao interface
6. Implement the DAO interface
Autowire the JdbcTemplate to a field and use @Qualifier annotation to specify which bean should be injected to it.
7. Conclusion
DataSourceBuilder builds data source from the values specified in the properties file.
Using the @Qualifier annotation we could specify the JdbcTemplate bean which should be injected in the DAO. Data will be fetched from the data source bounded to the bean.