I have two Spring contexts declared in my application: one for Spring-MVC queries, and the other for messagebroker Flex / BlazeDS queries mapped to different url patterns:
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>flex</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
The general context configuration ( /WEB-INF/applicationContext.xml) is declared here , and then each of the two contexts has its own configurations declared in spring-mvc-servlet.xmland, flex-servlet.xmlrespectively.
Inside flex-servlet.xmldeclared beans that are context specific flex. However, when a call arrives http://localhost/messagebroker/*, I get errors that these beans are not available.
This code is inside the custom Spring component, so it directly refers WebApplicationContextto accessing the declared beans:
public ISerializer getSerializer(Object source,boolean useAggressiveSerialization)
{
ServletContext ctx = FlexContext.getServletContext();
WebApplicationContext springContext = WebApplicationContextUtils.getRequiredWebApplicationContext(ctx);
String serializerBeanName = springContext.getBeanNamesForType(ISerializer.class);
}
, . .
, , springContext , configLocation - /WEB-INF/applicationContext.xml
, - ISerializer, , flex-servlet.xml.
? ( )?
EDIT:
, , ManageableComponentFactoryBean, , , bean factory. , ApplicationContextAware . :
<bean id="dpHibernateRemotingAdapterComponentFactory"
class="org.springframework.flex.core.ManageableComponentFactoryBean">
<constructor-arg
value="org.dphibernate.adapters.RemotingAdapter" />
<property name="properties">
<value>
{"dpHibernate" :
{
"serializerFactory" : "org.dphibernate.serialization.SpringContextSerializerFactory"
}
}
</value>
</property>
</bean>
org.dphibernate.serialization.SpringContextSerializerFactory. SpringContextSerializerFactory ApplicationContextAware .