I want to use a dynamic proxy as my controller's command class but i get the following error:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy160] to required type [
java.lang.Class] for property 'commandClass'
The reason I am doing this is because I have 2 interfaces to one implementation class, since I want to use 1 interface when using the class internally and the other when exposing the class in the API. I find that using a dynamic proxy will solve this problem for me.
My spring configuration are as follows:
The definition of the proxy is as follows:
and the controller is as follows:Code:<bean id="jobTarget" class="com.bsd.cg.core.job.JobImpl"/> <bean id="job" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="proxyInterfaces"> <value>com.bsd.cg.core.job.Job</value> </property> <property name="target"> <ref local="jobTarget"/> </property> </bean>
Code:<bean id="submissionController" class="com.bsd.webapp.action.submission.DEXSubmissionController" singleton="false"> <property name="commandName"> <value>job</value> </property> <property name="commandClass"> <ref bean="job"/> </property> <property name="formView"> <value>submission</value> </property> <property name="successView"> <value>submission</value> </property> <property name="sessionForm"> <value>true</value> </property> <property name="validators"> <list> <ref local="beanValidator"/> <ref local="submissionValidator"/> </list> </property> </bean>


Reply With Quote
) pass in the factory that creates the proxy to the controller, and then on createForm return a new instance from that factory.
