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

Bas Ven do-not-reply at jboss.com
Fri Jul 26 09:44:09 EDT 2013


Bas Ven [https://community.jboss.org/people/batter] created the discussion

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

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

--------------------------------------------------------------
I got sportsclub working after I went to github to get the latest version of it.  

Like I said, I got past the stacktrace, it is just the the spring beans are always null although I know the beans I am asking for have been instantiated since my spring application is working fine:


> | 
>  | @Spring(bean = "commanderServer", jndiName = "SpringCommander") |
> | 
>  | private commander.server.CommanderServer commanderServer; |
> | public String getCommanderServer(){ |
> |     String status = "Did not get a server object"; |
> |     try { |
> |         if ( commanderServer != null){  *<== Always null* |
> |             status = "Hey I got something"; |
> |         } |
> |     } catch (Exception e) { |
> |         status = e.getLocalizedMessage(); |
> |     } |
> |     return status; |
> 
> | 
>  | } |
> 

One difference I have is that my EJB's live in one ear and the Spring beans in a separate war, each having their own jars.  Not sure if this bean injection has a container (as in each ear, war etc) or JVM scope.
The spring beans are created in a java class that has the @Configuration annotation and the beans themselves are annotated with the @Bean annotation, like this:


> @Configuration
> public class MyConfiguration{
> 
>      @Bean
>      public MyInterface MyBean(){
>           return new MyInterfaceImpl();
>      }
> 
>
--------------------------------------------------------------

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

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/6e6b48da/attachment-0001.html 


More information about the jboss-user mailing list