问题:
严重: Exception sending context initialized event to listener instance of class com.centit.app.web.StartupListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bPrjMtrManager' defined in class path resource [com/centit/damsf/service/applicationContext-sf.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'bPrjMtrDao' of bean class [com.centit.damsf.service.impl.BPrjMtrManagerImpl]: Bean property 'bPrjMtrDao' is not writable or has an invalid setter method. Did you mean 'BPrjMtrDao'?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'bPrjMtrDao' of bean class [com.centit.damsf.service.impl.BPrjMtrManagerImpl]: Bean property 'bPrjMtrDao' is not writable or has an invalid setter method. Did you mean 'BPrjMtrDao'?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:699)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:575)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:68)
……
解决:
在action-servlet.xml配置文件中,按住Ctrl,移动鼠标到指定属性(如:'bPrjMtrDao'),若出现下划线则配置正确并有相应setter method与之对应;若无下划线则没有对应到指定setter method,setter method容易写错(如方法名不符合标准),所以最好自动生成,自动生成setter method后,重新检查配置文件,若属性配置正确,问题就解决了。
setter method——各属性对应java文件中的set方法(如:'setbPrjMgr')。
转载于:https://blog.51cto.com/jclpc/1351525