为什么创建不了datasource

来源:5-4 搭建Springboot分层项目

慕娘7173298

2020-03-08

图片描述
无论我是否配置了数据源都会报错,上网查找,添加:exclude={DataSourceAutoConfiguration.class}依然无济于事

#############################################################
##
## REDIS 配置
##
#############################################################
## Redis数据库索引(默认为0)
#spring.redis.database=1
## Redis服务器地址
#spring.redis.host=192.168.1.209
## Redis服务器连接端口
#spring.redis.port=6379
## Redis服务器连接密码(默认为空)
#spring.redis.password=imooc
## 连接池最大连接数(使用负值表示没有限制)
#spring.redis.jedis.pool.max-active=1000
## 连接池最大阻塞等待时间(使用负值表示没有限制)
#spring.redis.jedis.pool.max-wait=-1
## 连接池中的最大空闲连接
#spring.redis.jedis.pool.max-idle=10
## 连接池中的最小空闲连接
#spring.redis.jedis.pool.min-idle=2
## 连接超时时间(毫秒)
#spring.redis.timeout=0


############################################################
#
# 配置数据源相关	使用阿里巴巴的 druid 数据源
#
############################################################
spring.datasource.url=jdbc:mysql://localhost:3306/imooc-video-dev
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.druid.initial-size=1
spring.datasource.druid.min-idle=1
spring.datasource.druid.max-active=20
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.stat-view-servlet.allow=true


############################################################
#
# mybatis 配置
#
############################################################
# mybatis 配置
mybatis.type-aliases-package=com.imooc.pojo
mybatis.mapper-locations=classpath:mapper/*.xml
# 通用 Mapper 配置
#mapper.mappers=com.imooc.utils.MyMapper
mapper.not-empty=false
mapper.identity=MYSQL
# 分页插件配置
pagehelper.helperDialect=mysql
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql



# 文件上传配置
#spring.http.multipart.maxFileSize=100Mb
#spring.http.multipart.maxRequestSize=1000Mb
spring.servlet.multipart.max-file-size = 100MB
spring.servlet.multipart.max-request-size =1000MB

############################################################
#
# Server 服务端相关配置
#
############################################################
# 配置api端口号
server.port=8081

############################################################
# Server - tomcat 相关常用配置
############################################################
# tomcat的URI编码
server.tomcat.uri-encoding=UTF-8
写回答

1回答

慕娘7173298

提问者

2020-03-08

已经解决,课件里面多加了druid

<!-- 阿里开源数据源 -->
       <dependency>
           <groupId>com.alibaba</groupId>
           <artifactId>druid</artifactId>
           <version>1.1.0</version>
       </dependency>
<!--        <dependency>-->
<!--            <groupId>com.alibaba</groupId>-->
<!--            <artifactId>druid-spring-boot-starter</artifactId>-->
<!--            <version>1.1.0</version>-->
<!--        </dependency>-->

0
0

Spring Boot短视频小程序开发 全栈式实战项目

一门课程带你搞定短视频小程序全栈开发,毕业设计之利器!

2613 学习 · 1952 问题

查看课程