提出:今天做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配置文件,我的错误就是手残写错地方导致的

                                  解决Caused by: org.springframework.beans.NotWritablePropertyException总结

 

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

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2021-06-03
  • 2022-02-12
  • 2021-09-08
  • 2021-08-07
  • 2021-10-01
  • 2021-09-20
猜你喜欢
  • 2022-12-23
  • 2022-03-09
  • 2022-02-20
  • 2022-01-17
  • 2021-11-13
  • 2021-08-11
  • 2021-04-22
相关资源
相似解决方案