报错信息如下:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least  bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:)
... more

需要在配置类中添加

@ConfigurationProperties(prefix="spring.datasource")
@Bean
public DataSource druid(){
return new DruidDataSource();
}

Springboot 添加数据源报错的更多相关文章

  1. 新版本grafana添加数据源报错!

    前提: grafana配置的数据源url没有错误. 现象: 1)升级完grafana之后发现原来配置的open-facon数据源无效了,一直提示HTTP ERROR NOT FOUND. 2)安装新版 ...

  2. springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde

    springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde 创建 ...

  3. Springboot数据库连接池报错的解决办法

    Springboot数据库连接池报错的解决办法 这个异常通常在Linux服务器上会发生,原因是Linux系统会主动断开一个长时间没有通信的连接 那么我们的问题就是:数据库连接池长时间处于间歇状态,导致 ...

  4. Loadrunner参数化连接oracle、mysql数据源报错及解决办法

    Loadrunner参数化连接oracle.mysql数据源报错及解决办法 (本人系统是Win7 64,  两位小伙伴因为是默认安装lr,安装在 最终参数化的时候,出现连接字符串无法自动加载出来: 最 ...

  5. AS添加依赖报错Unable to merge dex

    AS添加依赖报错Unable to merge dex 最近在给项目添加依赖的时候,要给项目导入Bmob的SDK,参照Bmob的官方文档,可以直接在app的build.gradle文件中添加 //Bm ...

  6. ORACLE数据导入导出后新数据库中某些表添加操作报错[ORA-12899]

    由于项目需要,我在搭建了新的开发环境后,需要将之前环境中的ORACLE数据库导出,再导入到新的开发环境下.当导出导入完成后,使用数据库进行添加操作时 发现针对很多表的添加操作报错,具体报错原因描述为: ...

  7. Springboot 启动文件报错,原因是@ComponentScan写成了@ComponentScans

    Springboot 启动文件报错,原因是@ComponentScan写成了@ComponentScans

  8. ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加、报错“图形符号无法序列化为 JSON”

    ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加.报错“图形符号无法序列化为 JSON” 在上一篇博文中如果在 esri:Map 里面是否设置了的UseAcc ...

  9. springboot测试启动报错java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

    springboot测试启动报错: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you ne ...

随机推荐

  1. bzoj4264

    哈希 cf原题...没见过的话真想不出来 将邻接表排序哈希,判断是否相同,但是会漏掉两点相邻的情况,于是再把自己加入自己的邻接表,然后再哈希判断. #include<bits/stdc++.h& ...

  2. Integer值判断是否相等问题

    昨天在开发中遇到一个问题,定义了两个Integer变量,暂且定义为Integer a;  Integer b; 这两个值由前端赋值并传到后台,前台传的是a = 12345, b = 12345,  但 ...

  3. Spark 分布式环境--连接独立集群管理器

    Spark 分布式环境:master,worker 节点都配置好的情况下 : 却无法通过spark-shell连接到 独立集群管理器 spark-shell --master spark://soyo ...

  4. LD_LIBRARY_PATH设置问题

    今天突然遇到设置LD_LIBRARY_PATH的问题,,发现在.bashrc和/etc/profile中添加 exportLD_LIBRARY_PATH = path_name:$LD_LIBRARY ...

  5. 【158】◀▶ Linux-Bash学习

    鸟哥的 Linux 私房菜      Linux 的 26 个命令      Shell 脚本教程      Linux 命令大全 目录——按文件顺序: echo:显示变量内容 printf:格式化输 ...

  6. 常用的八大排序算法,含java实例(copy)

    说明:转载于http://www.cnblogs.com/qqzy168/archive/2013/08/03/3219201.html 分类: 1)插入排序(直接插入排序.希尔排序) 2)交换排序( ...

  7. 思维/构造 HDOJ 5353 Average

    题目传送门 /* 思维/构造:赛后补的,当时觉得3题可以交差了,没想到这题也是可以做的.一看到这题就想到了UVA_11300(求最小交换数) 这题是简化版,只要判断行不行和行的方案就可以了,做法是枚举 ...

  8. Oracle随机选择一条记录SQL

    Oracle随机选择一条记录SQL:

  9. php 报错如下:Notice: Trying to get property of non-object

    参考文档如下解决: https://stackoverflow.com/questions/5891911/trying-to-get-property-of-non-object-in 问题如下: ...

  10. ASP.NET MVC 生成验证码

    using System.Web.Mvc; using System.Drawing; using System; using System.Drawing.Imaging; using Models ...