现象:

按照教程步骤做的,但连单元测试都无法通过,会出现java.lang.IllegalArgumentException: Property ‘dataSource’ is required这个错误。

原因:

通过看错误提示怀疑是properties文件没有被加载进来,仔细检测发现路径没有写错。后面发现是版本不一样导致的,我一不小心升级成了2021.3版本,创建javaEE的过程和视频中的不一样,工程结构也不一样。

解决办法:

在用Jdbc访问数据库时,视频中是将druid.properties文件配置到src文件夹下时;2021.3版本是放到src/main/resources文件夹下。这样才会在编译的时候在target文件夹下生成配置文件。

黑马 java.lang.IllegalArgumentException: Property ‘dataSource‘ is required的更多相关文章

  1. MyBatis与Spring MVC结合时,使用DAO注入出现:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    错误源自使用了这个例子:http://www.yihaomen.com/article/java/336.htm,如果运行时会出现如下错误: Invocation of init method fai ...

  2. Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required [ IDEA mybatis项目报错 ]

    今天笔者用Springboot框架整合Mybatis做一个小小的项目: 代码写完,在运行项目时,IDEA给我报了3处错误: org.springframework.beans.factory.Unsa ...

  3. springboot整合mybatis的时候报错Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    今天闲来无事,学习springboot整合mybatis,在bilibili看视频学的,视频中在dao层的interface上面加上org.apache.ibatis.annotations.Mapp ...

  4. 使用 Jenkins 打包成功后 运行 出现 Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    linux 运行时 错误日志 Error starting ApplicationContext. To display the conditions report re-run your appli ...

  5. springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 异常

    今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionF ...

  6. springboot下Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    已检查jar包是否引入 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId ...

  7. java.lang.IllegalArgumentException: Attribute 'items' is required and must be a Collection, an Array or a Map

    很有可能是涉及items的时候写成了item导致此错

  8. spring boot :error querying database. Cause: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required

    配置多个数据源启动报错,error querying database. Cause: java.lang.IllegalArgumentException: dataSource or dataSo ...

  9. IDEA报错: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"

    运行审核流模块: 在ActivitiServiceApplication模块日志报错: Error starting ApplicationContext. To display the auto-c ...

  10. java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

    java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required 严重: Exceptio ...

随机推荐

  1. 12-K8S之调度器、预选策略和优选函数

    目录 调度器.预选策略和优选函数 1.nodeSelector nodeName调度: 2.节点亲和性调度(pod亲和于node节点) 3.pod亲和度调度(pod亲和于pod) 4.pod反亲和性度 ...

  2. 用有限差分估计(Finite Difference Estimate)解决地理坐标与平面像素坐标转换过程的误差造成风场粒子向量失真问题

    下载NCEP的气象场grib2数据,风场是二维的向量,包含u和v两个分量.这个用经纬度投影到像素坐标会产生误差,直接绘制效果不太对:(   通过插值计算得到风场粒子的预测数据wind = interp ...

  3. oracle学习之redo

    Oracle的重做日志基本概念及原理 重做日志文件 redo log file 通常也称为日志文件,它是保证数据库安全和数据库备份与恢复的文件,是数据库安全和恢复的最基本的保障.管理员可以根据日志文集 ...

  4. vue3插槽变化

    1.默认插槽还是跟以前一样 2.使用具名插槽时,子组件不变 以前的父组件掉用的时候 <template slot="example"> </template> ...

  5. 怎么把百度地图的搜索结果全部导出到Excel文件

    有很多人问我,怎么样能够快速的把BAIDU地图左边的搜索列表里的商家地图,电话,导出到EXCEL里. 我就开发了一个小软件,专门为快速的实现导出数据到EXCEL. 为了使用方便,已经将全国的所又省份, ...

  6. M1处理器的电脑xcode模拟器编译报错问题详解及解决方案

    在M1芯片的苹果电脑中使用Xcode编译模拟器时,可能会碰到如下报错: 原因是由于M1模拟器架构是arm64架构,而Intel芯片是x86_64的架构,从而导致编译出现了问题. 这些报错,都是是由于项 ...

  7. Vuex学习记录篇之王阿姨畅谈Vuex

    Vuex是干什么的,相信很多人和我一样刚开始不大清楚 大家都知道Vue实现组件通信(传参)有很多方式所谓通信就是指数据共享,父子通信,兄弟通信但是如果要频繁实现数据共享,那么以上的方法就有点力不从心了 ...

  8. 移动端性能测试--CPU资源

    一.背景 在很多场景下我们去使用 App,可能会碰到手机会出现发热发烫的现象.这是因为 CPU 使用率过高.CPU 过于繁忙,会使得整个系统无法响应用户,整体性能降低,用户体验变得相当差,也容易引起 ...

  9. 2022.11.09 NOIP2022 模拟赛六

    科学 Source:CF461C Appleman and a Sheet of Paper,*2200. 注意到对于 \(p\le \lfloor \frac {now}{2}\rfloor\),直 ...

  10. lg8862题解

    脑抽了,一开始想着扫描线然后用线段树求历史最大值.