tags:

views:

54

answers:

1

I have a bean in the root context (ApplicationContext) which autowires another bean in a WebContext and it's throwing:

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)}

I'm trying to get a MessageTemplate in PageFlowController, where PageFlowController is defined in the root context and MessageTemplate in a web context.

+1  A: 

A child context has access to beans in a parent context, but a parent context has no access to beans in a child context.

See the Spring Reference for more information.

James Earl Douglas