I have following code :
<bean name="/add" class="com.hestia.controllers.AddPropertyControlle r" parent="baseController">
<property name="commandName" value="property"/>
<property name="commandClass" value="com.hestia.property.UploadBean"/>
<property name="formView"><value>add-property</value></property>
<property name="successView"><value>hello</value></property></bean>
this works fine.. but UploadBean has fields like address which I was trying to inject through dependecy injection rather than writing in constructor..
so I wrote another bean like this :
<bean id="uploadBean" value="com.hestia.property.UploadBean">
<property name="address" value="com.hestia.property.address" />
</bean>
and changed the original definition as :
<bean name="/add" class="com.hestia.controllers.AddPropertyControlle r" parent="baseController">
<property name="commandName" value="property"/>
<property name="commandClass" ref="uploadBean"/>
<property name="formView"><value>add-property</value></property>
<property name="successView"><value>hello</value></property></bean>
but this throws following error :
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.hestia.command.beans.PropertyUploadBean] to required type [java.lang.Class] for property 'commandClass'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
I guess this accepts a class here..instead of a bean.. so how do I pass dependencies in this case ?


Reply With Quote