1. Problem
Sometimes we use spring boot, configuration dependent spring data jpa in dependence, it will automatically detect the source of the configuration data at this time when spring boot start, if not then reported no errors in the data source.
But this dependence must be because the code need to choose whether to enable a data source based on some conditions, then what to do?
2. Program
Arranged to set the following examples in SpringApplication:
spring.autoconfigure.exclude = org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
Examples are as follows: