参考,SpringBoot配置DataSource(简述版)_HD243608836的博客-CSDN博客
安装上述配置方式可能遇到的问题
- 出现一下提示
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).
没有进入对应的驱动,比如需要用dbcp2的数据源那么就要在pom里面引入以下依赖
-
<!-- 添加DBCP2依赖 -->
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-dbcp2</artifactId>
-
</dependency>