问答详情
源自:4-3 配置Action,Service,Dao的类-Struts2整合Spring

配置applicationContext.xml出错

-- 添加 -->     <!-- 配置业务层的类 -->             <bean id="addService" class="com.zhang.service.addService">     <property name="addDao" ref="addDao"></property>    </bean>                                           <!-- 配置Dao的类 -->                                      <bean id="addDao" class="com.zhang.dao.addDao">   
报错了
         </bean>Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'addDao' of bean class [com.zhang.service.addService]: Bean property 'addDao' is not writable or has an invalid setter method. Did you mean 'adao'?

提问者:qq_锦绣山河_0 2018-01-23 22:49

个回答

  • Jerry__Liang
    2018-03-20 11:10:39

    Did you mean 'adao'?你的类里面取名是这个,而你想用addDao,所以报错了,你检查一下你的名称是否一致,我的之前也报这个错误,原因就是多了个空格,真的严格--,希望对你有帮助

  • 慕少4997523
    2018-01-24 20:53:48

    从这两句话看没错,