報錯信息:
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver
錯誤原因:
@Configuration注解向spring注入了dataSource bean。因為工程中沒有關於dataSource相關的配置信息,當spring創建dataSource bean因缺少相關的信息就會報錯。
解決方案:
在Spring boot的啟動引導類上為注解增加條件@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}),阻止Spring boot自動注入dataSource