error:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.euphe.repository.UserRepository com.euphe.controller.MainController.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Using named parameters for method public abstract void com.euphe.repository.UserRepository.updateUser(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Integer) but parameter 'qPassword' not found in annotated query ' update UserEntity us set us.nickname = :qNickname, us.firstName=:qFirstName, us.lastName =:qLastName, us.password =: qPassword where us.id =:qId'!

 
问题:这个函数没办法识别qPassword
解决:原函数是这样的:
@Query(" update UserEntity us set us.nickname = :qNickname, us.firstName=:qFirstName, " +
"us.lastName =:qLastName, us.password =: qPassword where us.id =:qId")
看出问题来了吗?qPassword和别的的不同就是和:之间多了一个空格,所以没有被识别出来,自然不能Autowired了
 
修改之后:

@Query(" update UserEntity us set us.nickname = :qNickname, us.firstName=:qFirstName, " +
"us.lastName =:qLastName, us.password =:qPassword where us.id =:qId")

Injection of autowired dependencies failed的更多相关文章

  1. eclipse 启动tomcat报Spring错误 Error creating bean with name 'serviceOrderBiz': Injection of autowired dependencies failed

    启动tomcat报异常,提示Sring无法创建serviceOrderBiz(第一行红字),继续看是因为有一个自动注入的字段无法注入ModuleInterfaceBiz(第二行红字),检查servic ...

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

    出现了一大串错误,Error creating bean with name 'signController': Injection of autowired dependencies failed. ...

  3. 异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException

    这个异常是出现在注入配置文件中配置好的属性时报错的: Injection of autowired dependencies failed; nested exception is java.lang ...

  4. Failed to load ApplicationContext ,Error creating bean with name 'adminUserService': Injection of autowired dependencies failed;

    Druid配置的时候出现这个问题: "C:\Program Files\Java\jdk1.8.0_191\bin\java" -ea -Didea.test.cyclic.buf ...

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

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

    tomcat启动报错:Injectjion of autowired dependencies failed 环境: 操作系统:centos6.5 tomcat: 7.0.52 jdk:openjdk ...

  7. Error creating bean with name 'adminUserController': Injection of autowired dependencies failed;

    spring 个坑爹地,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ...

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

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

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

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

随机推荐

  1. 浅谈format格式化输出

    什么是format? 相对于基本格式化输出采用"%"的方法,format的功能强大,该函数把字符串当一个模板,通过传入的参数进行格式化,并且使用大括号"{}"作 ...

  2. bzoj 3048[Usaco2013 Jan]Cow Lineup 思想,乱搞 stl

    3048: [Usaco2013 Jan]Cow Lineup Time Limit: 2 Sec  Memory Limit: 128 MBSubmit: 237  Solved: 168[Subm ...

  3. 关于eclipse的mysql连接配置

    打开eclipse,选择Window→Open Perspective→Other→Database Development,然后在右边的导航栏右键点击Database Connections文件夹, ...

  4. Spring MVC中Session的正确用法之我见

    Spring MVC是个非常优秀的框架,其优秀之处继承自Spring本身依赖注入(Dependency Injection)的强大的模块化和可配置性,其设计处处透露着易用性.可复用性与易集成性.优良的 ...

  5. 一不小心把Mysql数据库的root的账号的权限给弄没啦,该怎么办

    别急啊,现在只要你还能连接到Mysql,就问题不大! 首先,连接道Mysql,这里用Navicat进行讲解. 说明:root@localhost和root@127.0.0.1不是一个账号,也不是一回事 ...

  6. 剑指offer第四天

    25.复杂链表的复制 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head.(注意,输出结果中请不要返回参数中的 ...

  7. Django 学习笔记

    day 1 : 一.web 框架本质: 1.http 建立在tcp 之上:一次互通后断开,无状态,短链接 请求头: b'GET / HTTP/1.1 Host: 127.0.0.1:8080 Conn ...

  8. hihoCoder 1033 : 交错和 数位dp

    思路:数位dp,dp(i, j, k)表示考虑i位数,每位数可以任意取[0~9],并且这i位数的交错和为j,k=1表示前缀全是0(如000456),k=0表示前缀不为0.注意,前缀是否为0是这道题的一 ...

  9. CodeForces - 796B 模拟

    思路:模拟移动即可,如果球落入洞中停止移动.注意:有可能第一个位置就是洞!! AC代码 #include <cstdio> #include <cmath> #include ...

  10. TI AM335X处理器介绍

    AM335X是美国TI(德州仪器)公司基于 ARM Cortex-A8内核的AM335X微处理器,在图像.图形处理.外设方面进行了增强,并全面支持诸如 EtherCAT 和 PROFIBUS等工业接口 ...