User development,

A new message was posted in the thread "@Autowiring of beans from Spring 
applicationcontext":

http://community.jboss.org/message/522098#522098

Author  : J H
Profile : http://community.jboss.org/people/joboss

Message:
--------------------------------------------------------------
Hi,
 
we want to evaluate JBoss 5.1.0 with Spring 2.5.6. I read a couple of threads 
in the forum and realized that all of the spring users make use of the 
-spring.xml files in the META-INFs of the corresponding .jars, .wars etc.
At the moment we have an .ear-structure like this and it went smooth in the 
GlassFishv3.
 
 
.ear
|
------  servicebeans-01.jar   -> beanRefContext.xml, serviceContext-01.xml
------  servicebeans-02.jar   -> serviceContext-02.xml
------  webservice-A.war
------  webservice-B.war
 
in the web.xml of the wars I use the following config
 
<context-param>
        <param-name>parentContextKey</param-name>
        <param-value>ear.context</param-value>
    </context-param>
    <context-param>
        <param-name>contextClass</param-name>
        
<param-value>org.jboss.spring.vfs.context.VFSXmlWebApplicationContext</param-value>
    </context-param>
    <listener>
        
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <description>Webservice Endpoint</description>
        <display-name>webservice</display-name>
        <servlet-name>webservice</servlet-name>
        <servlet-class>a.b.c.WebServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>webservice</servlet-name>
        <url-pattern>/webservice</url-pattern>
    </servlet-mapping>
 
there's a parentApplicationContext, that instantiates the required beans via 
the given config in beanRefContext.xml (defaultname in Spring) which is looked 
up in the classpath. Both webservices should use beans from this appCtx. 
Actually the deployment works fine, all the required beans are instantiated 
only once. Except one important thing. The wiring between the WebserviceImpl in 
the .wars and the appCtx with the serviceBeans is not done.
 
According to this presentation 
http://www.redhat.com/f/pdf/jbw/mbogoevici_1050_spring_on_jboss.pdf, it should 
be possible. Otherwise I misunderstood this part of the presentation and didn't 
recognize that it is made clear just to use the -spring.xml files.
 
page 20:
 
Method 1: Spring's SpringBeanAutowiringInterceptor
● EJB3 interceptor
● Uses a BeanFactoryLocator to retrieve the
ApplicationContext
● Recognizes the @Autowired annotation
 
I also used the SpringBeanAutowiringSupport, which worked fine in GlassFishv3 
... no success.
 
So in the end I am looking for a way that allows me to make use of Spring's 
@Autowiring without using the spring-deployer module for a common appCtx.
Is there any solution to keep the above mentioned .ear-configuration and let 
the autowiring be done by JBoss (modules)? I know that it is probably possible 
if i change my config to the corresponding -spring.xml  files but that's only 
the last solution i want to do. Otherwise I will die of config-management for 
my app in different ApplicationServers. Any help would be appreciated.
 
johannes

--------------------------------------------------------------

To reply to this message visit the message page: 
http://community.jboss.org/message/522098#522098


_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to