-
Jul 30th, 2007, 12:18 PM
#1
Jboss and Spring
I'm sorry if I've posted to the wrong forum topic here. I did a search for topics containing jboss and didn't find the answer I wanted so here goes.
I have written a spring application. I start that application by getting the ClassPathXmlApplicationContext in the main method, which loads the xml file.
Now I have need to run this application inside Jboss. I have found the page on the jboss site (http://wiki.jboss.org/wiki/Wiki.jsp?...ingIntegration) which supplies jboss-spring.deployer, which I put into my jboss instance, which will invoke my xxx.spring package.
Now what I want to know is, is this the best way to do it? If not what is?
If it isn't, can some please supply a sample war or some such? I've had an aweful time of this, and really need to make some head way. I'm not new to jboss, but I am new to having to create war files from scratch.
Personally, I would have thought a blank war, which some mbean creating the context would have been the way to go, but I don't know how to do it.
Hope someone can help me.
Thanks
Paul.
-
Jul 30th, 2007, 02:04 PM
#2
hmmm
Well I've now had a bit of a play with the jboss spring deployer. It is stuck in the age of Spring 1.2.5, which doesn't really suit me, as I really need 2.0.2, and it will need a rewrite to upgrade... So I'll left looking for a way to start a spring app from a war file.
-
Aug 1st, 2007, 08:13 AM
#3
Initialiaze Spring beans from war
In the web.xml for your war file you can specify the following , which will initialize the spring beans at startup :
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-services.xml,/WEB-INF/applicationContext-dataAccess.xml</param-value>
</context-param>
<!-- above xml files are spring bean config files packed in your war/WEB-INF -->
<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
-
Aug 1st, 2007, 09:25 AM
#4
Thanks diippi, but in the meantime I'd figured it out. It was chance find, as I was reading the spring docs, as I didn't really know what I was looking for....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules