请问老师为什么我是用druid配置后启动服务会报错呢?
来源:3-5 数据访问层搭建—集成Druid连接池

慕虎8754231
2020-02-28
#配置druid連接池
spring.druid.driverClassName=com.mysql.cj.jdbc.Driver
spring.druid.url = jdbc:mysql://127.0.0.1:3306/houses?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2b8
spring.druid.username = root
spring.druid.password = root
控制台报错如下:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
Disconnected from the target VM, address: '127.0.0.1:56095', transport: 'socket'
2020-02-28 12:47:17.232 ERROR 29360 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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 suitable jdbc url
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 (no profiles are currently active).
Process finished with exit code 1
写回答
3回答
-
慕虎8754231
提问者
2020-02-29
老师好,我在github上看到对应的配置,我看跟视频出入有点大,视频中并没有加入依赖
<dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.17</version> </dependency>
下面是github上的展示:
00 -
慕虎8754231
提问者
2020-02-29
不会吧,依赖我这边是引入了的。
00 -
格鲁
2020-02-29
看错误没有引入jar,再看看视频检查是不是哪里漏掉了
012020-02-29
相似问题