使用Spring时报错

错误内容:

Error creating bean with name 'registerStudentService' defined
 in URL [file:F:/apache-tomcat-8.0.52/webapps/school/WEB-INF/classes/conf/context-student.xml]:
 Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException:
 Invalid property 'registerTimeDao' of bean class [com.student.service.RegisterStudentService]:
 Bean property 'registerTimeDao' is not writable or has an invalid setter method.

 Does the parameter type of the setter match the return type of the getter?

这个错误很简单,只是很久没有使用spring了导致有些生疏了。我们看最后一句话: Does the parameter type of the setter match the return type of the getter?中文意思就是:设置器的参数类型是否与吸气剂的返回类型匹配?【使用百度翻译】其实说得直白一点,就是没有设置set方法和get方法。我在向registerStudentService中注入registerTimeDao时,忘记给registerTimeDao添加set方法和get方法,所以导致抛出这个异常,以后一定会多加小心!

猜你喜欢

转载自blog.csdn.net/dengyilang123/article/details/80372300
今日推荐