问题遇到的现象和发生背景
springBoot启动的时候报错
问题相关代码,请勿粘贴截图
yml配置文件
server:
port: 8001
mybatis:
type-aliases-package: com.mq.springcloud.pojo
config-location: classpath:mybatis/mybatis-config.xml
mapper-locations: classpath:mybatis/mapper/*.xml
spring:
application:
name: springcloud-provide
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.gjt.mm.mysql.Driver
url: jdbc:mysql://localhost:3306/db01?characterEncoding=utf-8&serverTimezone=GMT
username: root
password: ******
运行结果及报错内容
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
我的解答思路和尝试过的方法
尝试过在@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
但是加上上面部分代码后:
就会出现Error creating bean with name 'XXX' defined in file