[jboss-user] [Snowdrop] - Re: Accessing spring beans that are deployed in a war.

Tejas Mehta do-not-reply at jboss.com
Fri Jul 26 18:26:49 EDT 2013


Tejas Mehta [https://community.jboss.org/people/tmehta] created the discussion

"Re: Accessing spring beans that are deployed in a war."

To view the discussion, visit: https://community.jboss.org/message/830053#830053

--------------------------------------------------------------
Just to make sure attempted to deploy an ear with an ejb getting a spring injected by snowdrop from a *.spring deployment. The following was the configuration:

The EJB:
> @Stateful
> @Interceptors({SpringLifecycleInterceptor.class})
> public class GreeterEJB implements IGreeterEJB {
>     @Spring(bean = "springBean", jndiName = "MyApp")
>     private Object memberDao;
> 
> /** rest of class **/
> 
> 

In the ear pom.xml:
Note scope is not set provided:

> <dependency>
>      <groupId>org.jboss.snowdrop</groupId
>      <artifactId>snowdrop-deployers-core</artifactId>
>       <version>2.1.1.SNAPSHOT</version>
> </dependency>
Content of resources/META-INF/jboss-deployment-structure.xml:
Make sure this at the top level of the ear.

> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
>     <deployment>
>         <dependencies>
>             <module name="org.springframework.spring" slot="snowdrop" export="true">
>                 <exports>
>                     <include path="META-INF**"/>
>                     <include path="org**"/>
>                 </exports>
>                 <imports>
>                     <include path="META-INF**"/>
>                     <include path="org**"/>
>                 </imports>
>             </module>
>             <module name="org.jboss.snowdrop" export="true"/>
>         </dependencies>
>     </deployment>  
> </jboss-deployment-structure>
In META-INF/jboss-spring.xml of either the ear top level or a seperate *.spring application:

> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans"
>        xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd">
> 
> 
>           <description>BeanFactory=(MyApp)</description>
> 
>  /** beans or imports etc. **/
> 
> 
> </beans>

Hopefully this helps you out. If not I can send over this sample working solution (much smaller than sporstclub) and hopefully you can take it from there.

Cheers,

Tejas M.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/830053#830053]

Start a new discussion in Snowdrop at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2082]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130726/75cb43fc/attachment-0001.html 


More information about the jboss-user mailing list