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有问题...可我实在不明白到底哪里出错了...希望各位指点,谢谢!

阅读 2.5k
评论
    4 个回答

    因为少了jar包...

      • 4
      • 新人请关照

      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注解是写在方法上的?还是我见识少。

          • 3
          • 新人请关照

          autowired注解是写在成员变量上或者是set方法上的。

            撰写回答

            登录后参与交流、获取后续更新提醒

            相似问题
            推荐文章