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有问题...可我实在不明白到底哪里出错了...希望各位指点,谢谢!
autowired注解是写在成员变量上或者是set方法上的。