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

Tejas Mehta <[email protected]>
Newsgroups gmane.comp.java.jboss.user
Message-ID <[email protected]>
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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.