在学习springMVC+Mabatis的时候,添加注解@Resource报错

Injection of resource dependencies failed

de完bug后发现有几个点注意一下,基本上的问题都是spring没有扫描到mappre接口

调试一下以下几个地方:

1.applicationContext.xml

    <!-- 启用Spring注解形式扫描对象 -->
<context:component-scan base-package="com.sirifeng"/>

这里注意下包名(base-package)!!!

2.XXX_mapeer.xml文件中检查 namespace 是否正确

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace指向接口-->
<mapper namespace="com.sirifeng.chapter5.mapper.BooksMapper">
<!--
id与方法名保持一致
parameterType与参数类型保持一致
resultType与方法返回值保持一致
-->
<select id="findById" parameterType="String" resultType="com.sirifeng.chapter5.entity.Book">
select * from books where isbn = #{value}
</select> </mapper>

Java报错:Injection of resource dependencies failed的更多相关文章

  1. tomcat启动报错:Injection of autowired dependencies failed

    Error creating bean with name 'backPrintPaperController': Injection of autowired dependencies failed ...

  2. Java报错:Error creating bean with name 'testController': Injection of resource dependencies failed

    报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testCo ...

  3. 【解决方案】 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userHandler': Injection of resource dependencies failed;

    一个错误会浪费好多青春绳命 鉴于此,为了不让大家也走弯路,分享解决方案. [错误代码提示] StandardWrapper.Throwableorg.springframework.beans.fac ...

  4. Injection of resource dependencies failed解决办法总结

    今天调试项目代码,出现的引resource的报错,查原因查了好长时间才找到,现在这里总结一下,以免以后忘掉以及给大家参考. 报错大致内容入下: org.springframework.beans.fa ...

  5. Error creating bean with name 'testController': Injection of resource dependencies failed;

    启动ssm项目报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't ...

  6. 使用Mybatis整合spring时报错Injection of autowired dependencies failed;

    这是无法自动注入,通过查找,我出错的原因在于配置文件的路径没有写对,在applicationContext.xml中是这样写的. <bean id="sqlSessionFactory ...

  7. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplierAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factor

    这个错误是因为抽象Action类的时候,把ServletContext写成了serverContext,导致无法注入,正确写法是 import javax.annotation.Resource; i ...

  8. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fundService': Injection of resource dependencies failed;

    在进行SSM的Controller的编写, 从浏览器访问后端Controller的时候遇到了这个问题. 这个问题的描述: 创建Bean的对象失败 错误代码如下: @Service("fund ...

  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 ...

随机推荐

  1. eval()计算某个字符串,js和jquery都可以使用

    实例 执行JavaScript代码或表达式: <script>eval("x=10;y=20;document.write(x*y)");document.write( ...

  2. count()用法

  3. Swagger整合Jwt授权配置

    Swagger整合Jwt授权配置 欢迎关注博主公众号「Java大师」, 专注于分享Java领域干货文章http://www.javaman.cn/sb2/swagger-jwt 一.Swagger入门 ...

  4. LGP4229题解

    某位寄吧的故事 下文的 \(m\) 即为题面中的 \(Q\). 离散化,把序列变成 \(O(2m)\) 个部分,然后对这 \(O(2m)\) 个部分把最大值求出来,每次把最大值相同的部分拉出来,再把限 ...

  5. info sharp Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag

    执行 npm install 编译出错,提示 ERR! sharp EACCES: permission denied, mkdir '/root/.npm' info sharp Are you t ...

  6. SQL注入及防止SQL注入

    •SQL注入 SQL注入是通过操作输入来修改事先定义好的SQL语句,对用户输入的字符串进行过滤,转义,限制或处理不严谨,导致用户可以通过输入精心构造的字符串去非法获取到数据库中的数据,以达到执行代码对 ...

  7. 【KiCad镜像】下载与安装

    镜像下载.域名解析.时间同步请点击 阿里云开源镜像站 一.KiCad介绍 KiCad EDA 是一款用于印刷电路板设计的开源自由软件,基于 GPLv3 开源协议. 软件包含工程项目管理.原理图设计.线 ...

  8. Microsoft Edge如何安装去广告插件

    Microsoft Edge如何安装去广告插件 第一步:安装最新版本Edge https://www.microsoft.com/zh-cn/edge?form=MA13DO&OCID=MA1 ...

  9. 七天接手react项目 系列 —— react 路由

    其他章节请看: 七天接手react项目 系列 react 路由 本篇首先讲解路由原理,接着以一个基础路由示例为起点讲述路由最基础的知识,然后讲解嵌套路由.路由传参,最后讲解路由组件和一般组件的区别,以 ...

  10. python的内存回收机制

          变量相当于门牌号,当门牌没有了,即函数的引用都没有调用了,内存的数据就会被清除掉. python内有个定时器,定期的会刷新,如果发现内存中数据被引用了,就会被回收,这个就是内存的回收机制 ...