当前位置: 代码迷 >> Java Web开发 >> spring bean配置有关问题
  详细解决方案

spring bean配置有关问题

热度:38   发布时间:2016-04-17 01:24:30.0
spring bean配置问题
ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/web/console/subratio/subratio' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'subratioBusiness' of bean class [com.medicare.struts.action.SubratioAction]: Bean property 'subratioBusiness' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.NotWritablePropertyException: Invalid property 'subratioBusiness' of bean class [com.medicare.struts.action.SubratioAction]: Bean property 'subratioBusiness' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:567)

这是出现的问题
spring配置文件
<bean name="/web/console/subratio/subratio"
class="com.medicare.struts.action.SubratioAction">
<property name="subratioBusiness">
<ref local="subratioBusiness" />
</property>
</bean>
<bean id="subratioBusiness"
class="com.medicare.businessimp.SubratioBussinessImplements">
<property name="s709DAO">
<ref local="s709DAO" />
</property>
</bean>
<bean id="s709DAO" class="com.medicare.daoimp.S709DAOImplements">
<property name="hibernateTemplate">
<ref local="hibernateTemplate"/>
</property>
</bean>

struts里
<action attribute="subratioForm"
input="/web/console/subratio/subratio.jsp" name="subratioForm"
path="/web/console/subratio/subratio" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="show" 
path="/web/console/subratio/show.jsp"/>
<forward name="modify" 
path="/web/console/subratio/modify.jsp"/>
<forward name="redirect" 
path="/web/console/subratio/redirect.jsp"/>
<forward name="export" 
path="/web/console/subratio/export.jsp"/>
<forward name="targetA" 
path="/web/console/subratio/targetA.jsp"/>
<forward name="targetB" 
path="/web/console/subratio/targetB.jsp"/>
<forward name="targetC" 
path="/web/console/subratio/targetC.jsp"/>
<forward name="targetD" 
path="/web/console/subratio/targetD.jsp"/>
</action>

帮我看一下

------解决方案--------------------
初始化上下文失败
你的Struts的Action在Spring配置里面必须跟path参数的值一样.
  相关解决方案