I have a spring web application (currently packaged as a war file) which I would like to be able to launch from jetty in a stand-alone configuration (small scale all-in-one deployment, and for launching in the development environment).
Since I am already using spring, it seems like what I want to do is create my jetty Server and WebContext objects, and initial JNDI con开发者_开发问答text using spring. However this seems to overlap with the jetty.xml method of configuring the same environment.
Is one approach better? Is the does jetty.xml offer anything easier than I can get using spring?
I'd use jetty.xml for the Jetty configuration. If run into trouble with it, you will get easier help.
Also you would need two different Spring setups to configure both Jetty and your webapp, if you go the Spring route.
Using jetty.xml allows you to run the auto starter, which makes using JSP pages much much easier (via java -jar start.jar
). After going down the spring route, I have discovered that the jetty xml syntax hides some non-intuitive object relations; for example, who would have thought that simply instantiating a org.eclipse.jetty.plus.jndi.Resource
would also expose it through JNDI.
Also, with jetty.xml you don't end up with all the spring classes loaded twice (once for the container and once for the spring application). I'm sure there is some way around this.
精彩评论