zoukankan      html  css  js  c++  java
  • 解决Caused by: org.springframework.beans.NotWritablePropertyException总结

           提出:今天做springxml的setter注入属性demo出现的属性无法注入的bug.

          错误信息如下:

    Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property '27' of bean class [com.wg.xml_setter.Person]: Bean property '27'

                                          is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

            解决思路:

                                (1):一般属性的正确的getter和setter的第二个字母是大写,有时利用快捷键生成时第二个字母是小写,故无法注入.

                                               属性编写规范:忌属性名在合成单词时都使用大写

                                (2):检查xml配置文件,我的错误就是手残写错地方导致的

                                     

     

                                           这里我把本该写age的填了值

  • 相关阅读:
    P1522 牛的旅行
    P1908 逆序对
    P1107 雷涛的小猫
    欧拉函数
    P2679 子串
    P1063 能量项链
    P1052 过河
    P1020 导弹拦截
    P1330 阳光封锁大学
    P1198 最大数
  • 原文地址:https://www.cnblogs.com/w-gao/p/7136334.html
Copyright © 2011-2022 走看看