报错信息太多,选取其中一部分:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAction' defined in class path resource [c/applicationContext.xml]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'userService ' of bean class [c.UserAction]: Bean property 'userService '
is not writable or has an invalid setter method. Did you mean 'userService'?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1453)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
发现是set方法名写错了,应该是“userService”,我写的是“userService ”,多了一个空格。空格去掉后运行就正常了。