May 9th, 2012, 06:02 AM
spring within jboss container
I have some doubts with spring integrated in jboss.
There are many application context xml files.
I'm using @Inject to inject a bean.
Now if my xml has spring integration modules like "ftp -channel addapter" , there is no bean but I have to resolve the channels in the adapters.
For this purpose I need the application contxt and I think I should be using BeanFactoryChannelResolver to pass the application context and then use the channel resolver.
How do I get the application context.
Any help is appreciated.
May 9th, 2012, 06:09 AM
Every namespace-based component (e.g., channel, adapter, filter etc.) is a bean. So if it has an ID you can inject it anywhere you want as any other bean.
When you say many application context do you actually mean cross-application context communication (e.g., many different WARs) or many application context configuration files?
May 9th, 2012, 06:22 AM
one war file but many application context files.
So for SFTpSessionFactory I used @inject sftpsessionfactory and for sftp channel id I used
@Inject MessageChannel <ChannelName> but for the channel name I get null pointer exception
May 9th, 2012, 06:24 AM
can you show your configuration and code that triggers NPE?
May 9th, 2012, 06:25 AM
Also, have you gone through our samples? There are quite a few container based samples there.
May 9th, 2012, 07:02 AM
Please point to the exact example for the container based samples.
May 9th, 2012, 07:05 AM
'http', 'ws-inbound' etc. Just go through README files and see what the instructions are and any sample that requires a server is what you are looking for
May 9th, 2012, 07:25 AM
I saw the http example and I'm using the spring beans to configure the context.xml but in the test demo you seem to be using the ClassPathApplicationConext to get the bean.Please provide pointerss to see how the bean can be injected and how the channels are resolved.
May 9th, 2012, 07:28 AM
Please read the README file which gives you all the details you need. The demos like HTTP and others alike consists of two parts - server and client to interact with server component. The server part is what's being deployed to JBoss, Websphere, Tomcat or any other Java application server and the client is what talks to the server.
May 9th, 2012, 08:37 AM
Please correct me if I'm wrong.
I wasn't able to get to the correct sample.I need to get the reference of the sftp namespace and then get the channel id.i wasnt able to get this information from the samples.