【springboot整合druid】java.sql.SQLException: url not set

问题描述

未使用自动装配的机制,实现springboot整合druid时(就是使用druid的jar包,而不是druid-spring-boot-starter)报错

<dependency>
  <groupId>com.alibaba</groupId>
  <artifactId>druid</artifactId>
  <version>1.1.22</version>
</dependency>

问题原因

1、@ConfigurationProperties(prefix = "spring.datasource.druid")配置的prefix和.yml(.properties)中的不一致

2、注解@ConfigurationProperties(prefix = "xxxx")位置标注错误,应该放在对应的bean上,而不是类上

posted @ 2021-03-26 17:04  小小程序猿-DB  阅读(4559)  评论(0编辑  收藏  举报