springmvc中使用jdbcTemplate和dbcp
springmvc中使用jdbcTemplate和dbcp结果出了问题
配置文件如下:
repository接口如下:
repository实现中的依赖注入部分如下:
控制器如下依赖部分如下:
报错:
StandardWrapper.Throwable org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managerController' defined in file [D:\Program Files\Tomcat 7.0\webapps\UserManage\WEB-INF\classes\com\wq\web\managerController.class]: **Unsatisfied dependency expressed through constructor argument with index 0 of type [com.wq.data.UserRepository]**: : Error creating bean with name 'jdbcUserRepository' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'jdbcTemplate' of bean class [com.wq.data.jdbcUserRepository]: Bean property 'jdbcTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcUserRepository' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'jdbcTemplate' of bean class [com.wq.data.jdbcUserRepository]: **Bean property 'jdbcTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?**
一说控制器的依赖有问题,一说jdbcTemplate有问题...可我实在不明白到底哪里出错了...希望各位指点,谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
因为少了jar包...
Bean property 'jdbcTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
你的autowired注解是写在方法上的?还是我见识少。
autowired注解是写在成员变量上或者是set方法上的。