在线等啊!!!奇怪SSH访问action的时候配置出错
异常信息
HTTP Status 500 - Unable to instantiate Action, BankAction, defined for 'ssh' in namespace '/'Error creating bean with name 'BankAction' defined in file [D:\apache-tomcat-6.0.37\webapps\ssh_\WEB-INF\classes\applicationContext._yi.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'Service' of bean class [action.login.Action_login]: Bean property 'Service' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
<beans>
配置文件
<!-- 第一步:new三大层 -->
<bean id="bandao" class="dao.login.DaoInf">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="Service" class="service.login.ServiceInf" autowire="byType">
</bean>
<bean id="BankAction" class="action.login.Action_login" scope="prototype">
<property name="Service" ref="Service"></property>
</bean>
</beans> ssh 异常
[解决办法]
BankAction 实例化失败,无法设置 Service 属性。
能否把 BankAction 的代码贴一下
[解决办法]
Invalid property 'Service' of bean class [action.login.Action_login]: Bean property 'Service' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
私有变量Service 没有setter方法或者setter方法错误。私有变量的头字母最好小写,你的是Service大写,你改下试试