请问老师为什么我是用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上的展示:

//img1.sycdn.imooc.com/szimg/5e5a552809802c5311650807.jpg

//img.mukewang.com/szimg/5e5a553c094b974611560781.jpg

0
0

慕虎8754231

提问者

2020-02-29

不会吧,依赖我这边是引入了的。

//img.mukewang.com/szimg/5e5a480f093ffc9a09420797.jpg

0
0

格鲁

2020-02-29

看错误没有引入jar,再看看视频检查是不是哪里漏掉了

0
1
慕虎8754231
老师,上面我是引入了了依赖呀。
2020-02-29
共1条回复

Java从单体到微服务打造房产销售平台

单体开发,SpringCloud微服务改造,架构原理剖析,让你在大型项目中独当一面!

711 学习 · 349 问题

查看课程