2010-09-15 4 views
1

J'ai un haricot dans le contexte racine (ApplicationContext) qui autowires un haricot dans un WebContext et il est jeter:Ne peut pas lier automatiquement haricot enfant (défini dans un contexte web) à partir du contexte racine

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pageFlowController': Injection of autowired dependencies failed; nested exception is 
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.flex.messaging.MessageTemplate 
com.biosds.gcfs.nassic.flow.PageFlowController.msgTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type 
[org.springframework.flex.messaging.MessageTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: 
{@org.springframework.beans.factory.annotation.Autowired(required=true)} 

Je suis en train pour obtenir un MessageTemplate dans PageFlowController, où PageFlowController est défini dans le contexte racine et MessageTemplate dans un contexte Web.

+1

Alors, comment pourrais-je résoudre ce problème? J'ai besoin d'envoyer un message flexible via PageFlowController ET j'ai besoin de partager PageFlowController parce que j'ai un autre Web Context avec des contrôleurs Restful. – einundswanzig

Répondre

4

Un contexte enfant a accès aux beans dans un contexte parent, mais un contexte parent n'a pas accès aux beans dans un contexte enfant.

Voir le Spring Reference pour plus d'informations.

Questions connexes