PictureController needs a setPictureDao(PictureDao pictureDao) method. -A
-----Original Message----- From: Christian Decker [mailto:[EMAIL PROTECTED] Sent: Tue 10/28/2008 7:12 PM To: [email protected] Subject: [appfuse-user] Accessing DAOs in the controllers Hi all, I have a little problem which is causing me some headache: I have defined a new Dao to handle pictures and defined it in ApplicationContext.xml like this ---snip--- <bean id="pictureDao" class="bla.bla.bla.PictureDao"> <property name="sessionFactory" ref="sessionFactory"/> <property name="pictureRepo" ref="pictureRepository"/> </bean> ---/snip--- and then I want to pass it to the PictureUploadController (a modified copy of the FileuploadController) like this: ---snip--- <bean id="pictureController" class="bla.bla.controller.PictureController"> <property name="pictureDao" ref="pictureDao"/> <property name="userManager" ref="userManager"/> </bean> ---/snip--- But this is where I get the folling error: ---snip--- 2008-10-29 00:05:39.951::WARN: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping#0' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pictureUploadController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [bla.bla.bla.PictureDao] for property 'pictureDao'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [bla.bla.bla.PictureDao] for property 'pictureDao': no matching editors or conversion strategy found: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [bla.bla.bla.PictureDao] for property 'pictureDao': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) ---/snip--- Which, I guess, is because it can't find the pictureDao and then interprets the "pictureDao" as a String, right? Anyone has an idea how to fix this? Thanks, Christian -- View this message in context: http://www.nabble.com/Accessing-DAOs-in-the-controllers-tp20217953s2369p20217953.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
