Jetty Logo
Version: 9.3.7.v20160115
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Chapter 26. Frameworks

Table of Contents

Spring Setup

Spring Setup

You can assemble and configure Jetty in code or with almost any IoC style framework including Spring. If all you want to do is setup a Jetty server in your stock Spring usage, simply look at the xml snippet below as an example. If you want to replace the jetty-xml being used to start the normal Jetty distribution with spring, you may do so however currently it will not leverage the rest of the module system.

Jetty-Spring Module

The skeleton of a jetty spring module can be enabled from the jetty-distribution via the module mechanism. For example:

$ java -jar start.jar --add-to-startd=spring

This (or the alternative --add-to-start=spring command) creates a ${jetty.home}/lib/spring directory and populates it with the jetty-spring integration jar. It does NOT supply the spring jars and their dependencies. You will need to download these and place them into jetty's classpath - you can use the ${jetty.home}/lib/spring directory created by spring.mod for this purpose.

Using Spring to Configure Jetty

Configuring Jetty via Spring is simply a matter of calling the API as Spring beans. The following is an example mimicking the default jetty startup configuration.

See an error or something missing? Contribute to this documentation at Github!(Generated: 2016-03-17)