[jboss-user] [JBoss/Spring Integration] - Re: Using beans from other spring module

jussi_po do-not-reply at jboss.com
Tue Jan 9 09:08:12 EST 2007


Ok, that helped and I got bit ahead. 

But now, when I use those classes in another spring module, the second spring module is bind to the first modules application context. Meaning that the classes from second module are actually inside first.

2 spring modules:
core.spring
second.spring

First module(core.spring) jboss-spring.xml:
<?xml version="1.0" encoding="UTF-8" ?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
  | <beans>
  | 
  | <bean name="MessageManager"
  | 		class="com.core.MessageManagerImpl">
  | 		<property name="hibernateTemplate">
  | 			<ref bean="hibernateTemplate" />
  | 		</property>
  | 	</bean>
  | </beans>

The jndi config file of this(I'm not sure that I'm doing this right):
<?xml version="1.0" encoding="UTF-8" ?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
  | <beans>
  | 
  | 	<description>ParentBeanFactory=(a_spring-core)</description>
  | <bean id="MessageManager"
  | 		class="org.springframework.jndi.JndiObjectFactoryBean">
  | 		<property name="cache">
  | 			<value>true</value>
  | 		</property>
  | 		<property name="proxyInterface">
  | 			<value>com.core.MessageManager</value>
  | 		</property>
  | 		<property name="jndiName">
  | 			<value>a_spring-core</value>
  | 		</property>
  | 	</bean>
  | 
  | </beans>

And then In other spring module(second.spring), I try to use the beans from the first module:
<?xml version="1.0" encoding="UTF-8" ?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
  | <beans>
  | 
  | 	<import resource="jndi_core.xml" />
  | <bean name="MbloxConverter"
  | 		class="com.converter.MbloxConverterImpl">
  | 		<property name="messageManager">
  | 			<ref bean="MessageManager" />
  | 		</property>
  | 
  | 	</bean>
  | </beans>

This second.spring module is actually bind to the JNDI as "core.spring", and I guess it is because of the import in config file.

And also I have other module(spring) which uses the beans from both of those modules, and it won't find the bean from second.spring module. 

Or should I just make a one spring module?(I prefer to keep them separate)  

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

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



More information about the jboss-user mailing list