现象:

按照教程步骤做的,但连单元测试都无法通过,会出现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. Android组件化开发-----页面路由(ARouter)

    平时开发中,我们经常用到页面跳转功能.之前我一直使用Intent过跳转 Intent intent = new Intent(A.this, B.class); intent.putExtra(&qu ...

  2. @Service注解

    @Service注解的作用之一就是添加在Service层做Bean实例化, 在遇到service层方法有多个实现时也可指定@Service(name=""),并在controlle ...

  3. DELL服务器基于centos7安装OMSA

    DELL服务器基于centos7安装OMSA 参考链接: https://www.cnblogs.com/sky-cheng/p/14951071.html https://www.dell.com/ ...

  4. webpackHotMiddleware改造成koa支持的中间件

    const stream = require('stream'); const webpackHot = require('webpack-hot-middleware'); const PassTh ...

  5. 阿里云经典网络Debian 11 启动非常慢

    有一台阿里云经典网络的实例.系统太老了,重装了Debian 11,但是启动非常慢,要5分钟才能开机,简直离谱. root@AliYun:~# systemd-analyze blame 5min 3. ...

  6. 清理缓存tc

    /$SYNC 今天修改自建表的字段,换了参考字段但是SE16N显示一直没有改变,删字段,删表都尝试依旧无果,实际上只是没有清理缓存,扑街,留存

  7. 记一次couchbase(memcached)安装以及使用

    环境 CentOs 6.5 final 1.下载软件包 wget http://packages.couchbase.com/releases/2.1.0/couchbase-server-enter ...

  8. mixup: BEYOND EMPIRICAL RISK MINIMIZATION概述

    参考简书,github 0.前言 相关资料: arxiv github 论文解读 论文基本信息: 领域:数据增强 发表时间:arxiv 2022(2022.5.1) 1.针对的问题 大型的深度神经网络 ...

  9. 物流扫码固定式扫描相机BXT-10M 自动分拣读码器 条码识别扫码器

    物流扫码固定式扫描相机BXT-10M 自动分拣读码器 条码识别扫码器   VX : orihard2014   标签: 条码识别扫码器, 自动分拣读码器, 物流扫码固定式扫描相机, 物流扫码相机

  10. js实现网页自动跳转到手机页面

    网站既包含PC端页面,又包括手机端页面时,打开手机端自动跳转手机页面,js代码如下 <script type="text/javascript"> var mobile ...