[jboss-user] [JBoss/Spring Integration] - Re: Spring Component Auto Detection

trybik do-not-reply at jboss.com
Mon May 11 10:13:58 EDT 2009


Hello,
I am trying to make LAMS project work on JBoss 5.
Recently we started using ContextSingletonBeanFactoryLocator in Spring. So we declared in our WARs:


  | <param-name>contextConfigLocation</param-name>
  | 	<param-value>classpath:/org/lamsfoundation/lams/admin/adminApplicationContext.xml</param-value>
  | </context-param>
  | <context-param>
  |    <param-name>locatorFactorySelector</param-name>
  |    <param-value>classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml</param-value>
  | </context-param>
  | <context-param>
  | 	<param-name>parentContextKey</param-name>
  | 	<param-value>context.central</param-value>
  | </context-param>
  | 

Even if we add


  | <context-param>
  |     <param-name>contextClass</param-name>
  |     <param-value>org.jboss.spring.factory.VFSXmlWebApplicationContext</param-value>
  | </context-param>
  | 

it will not work. I guess VFSXmlWebApplicationContext is used only for contextConfigLocation parameter. For locating beanRefFactory.xml files PathMatchingResourcePatternResolver is used and it does not "understand" VFS. Is there a solution (class, parameter, workaround) to make it work?

But there is more important issue. In LAMS we have only one beanRefContext.xml, so we can get rid of the wildcards. But the file itself reads:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  | <beans>
  | 	<bean id="context.central"
  |          class="org.springframework.context.support.ClassPathXmlApplicationContext">
  |      <constructor-arg>
  |        <list>
  |        		<value>/org/lamsfoundation/lams/applicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/toolApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/contentrepository/applicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/learning/learningApplicationContext.xml</value>
  | 			 <value>classpath*:org/lamsfoundation/lams/tool/**/*pplicationContext.xml</value> 
  | 			  <value>/org/lamsfoundation/lams/tool/mc/mcApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/tool/forum/forumApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/tool/noticeboard/nbApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/web/webApplicationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/integrationContext.xml</value>
  | 			<value>/org/lamsfoundation/lams/usermanagement/ldapContext.xml</value>
  |        </list>
  | 	 </constructor-arg>
  | 	</bean>
  | </beans>
  | 

As you can see, we use wildcards to scan for Application Context files in all of our tools. Since some tools can be deployed or not, we can not write a full, proper list of tools. Discovery by wildcards in classpath is a very useful solution for us.

But it also stopped working, same reason - VFS bug. We tried to use VFSXmlWebApplicationContext, but it does not take list of paths as a constructor argument.
Is there something similar to VFSXmlWebApplicationContext, but inheriting from ClassPathXmlApplicationContext (thus having the needed constructor) and supporting VFS?
Or maybe you know a workaround?

A quick reply would be appreciated, as we are about to start using JBoss 5 and this is one of not many issues preventing us from doing it.

Thank you,
Marcin Cieslak

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4230068#4230068

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4230068



More information about the jboss-user mailing list