Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

This code is now part of Spring Boot 1.2.0. Please get that if you want to use Jersey.

Originaly this project provides Jersey autoconfiguration for a Spring Boot application. Feedback is more than welcome, especially in the form of pull requests.

Getting Started

Include this project as a dependency in a Spring Boot web application. If you are using a snapshot version you will need to build it locally first, or point your Maven settings at "".

First create a Spring Boot application with @EnableAutoConfiguration:

public class Application {

	public static void main(String[] args) {, args);


Then include a @Component of type ResourceConfig (from Jersey) that sets up the Jersey container, e.g.

public class JerseyConfig extends ResourceConfig {

	public JerseyConfig() {


And then define your REST endpoints using Spring beans annotated with JAX-RS, e.g.

public class Endpoint {

	public String message() {
		return "Hello";


That's it! Since the Endpoint is a Spring @Component its lifecycle is managed by Spring and you can @Autowired dependencies and inject external configuration with @Value. The Jersey servlet will be registered and mapped to "/*" by default. You can change the mapping by adding @ApplicationPath to your ResourceConfig.

Because it is a Spring Boot app you can run it from the main method or from an executable JAR. You can refer to the Jersey Sample for a detailed example (the sample is a deployable, executable WAR).

Example Build Configuration

Example pom.xml (excluding repository declarations):

<project xmlns="" xmlns:xsi=""







Jersey 1.x

There's no explicit autoconfiguration support for Jersey 1.x and Spring Boot, but the sample shows it is actually pretty trivial to integrate. Example application:

public class Application {

    public static void main(String[] args) {
       new SpringApplicationBuilder(Application.class).web(true).run(args);
    public String hello() {
    	return "Hello World";
    public FilterRegistrationBean jersey() {
    	FilterRegistrationBean bean = new FilterRegistrationBean();
    	bean.setFilter(new ServletContainer());
    	bean.addInitParameter("", "com.sun.jersey;demo");
		return bean;


Jersey autoconfig support for Spring Boot






No packages published