Hi,
I have a problem autowiring a bean to a controller. The autowiring is done through annotations.
The Controller code is:
The bean definition in the application-context.xml file is:Code:(at)Autowired protected ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource;
The controller definition is:Code:<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="WEB-INF/i18n/messages"/> <property name="cacheSeconds" value="1"/> <property name="defaultEncoding" value="UTF-8"/> </bean>
The error I get when trying to deploy the application in Tomcat is:Code:<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="interceptors"> <list> <ref bean="localeChangeInterceptor"/> </list> </property> <property name="mappings"> <value> /ajax/add_person.xml=addPersonController </value> </property> </bean>
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'addPersonController': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: protected org.springframework.context.support.ReloadableReso urceBundleMessageSource com.treert.web.ajax.AddPersonController.messageSou rce; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [org.springframework.context.support.ReloadableReso urceBundleMessageSource] is defined: Unsatisfied dependency of type [class org.springframework.context.support.ReloadableReso urceBundleMessageSource]: expected at least 1 matching bean
I have another bean defined in the same application-context file, specified using the same autowiring annotation and that one works just fine. What is the problem with this reloadableResourceBundleMessageSource bean?
Thank you for your time....


Reply With Quote
