MCPcopy Index your code
hub / github.com/dsyer/spring-boot-jersey

github.com/dsyer/spring-boot-jersey @1.0.0.M1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0.M1 ↗ · + Follow
27 symbols 43 edges 7 files 2 documented · 7% updated 6y ago★ 521 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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 "http://repo.spring.io".

First create a Spring Boot application with @EnableAutoConfiguration:

@ComponentScan
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

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

@Component
public class JerseyConfig extends ResourceConfig {

    public JerseyConfig() {
        register(Endpoint.class);
    }

}

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

@Component
@Path("/hello")
public class Endpoint {

    @GET
    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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.demo</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.0.0.BUILD-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-jersey</artifactId>
            <version>1.0.0.BUILD-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <start-class>demo.Application</start-class>
        <java.version>1.7</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Core symbols most depended-on inside this repo

Shape

Method 18
Class 9

Languages

Java100%

Modules by API surface

spring-boot-jersey/src/test/java/org/springframework/boot/jersey/demo/DefaultServletPathTests.java6 symbols
spring-boot-jersey/src/test/java/org/springframework/boot/jersey/demo/CustomServletPathTests.java6 symbols
spring-boot-jersey/src/main/java/org/springframework/boot/jersey/autoconfigure/JerseyAutoConfiguration.java6 symbols
spring-boot-sample-jersey/src/main/java/sample/jersey/Application.java3 symbols
spring-boot-sample-jersey/src/test/java/sample/jersey/ApplicationTests.java2 symbols
spring-boot-sample-jersey/src/main/java/sample/jersey/JerseyConfig.java2 symbols
spring-boot-sample-jersey/src/main/java/sample/jersey/Endpoint.java2 symbols

For agents

$ claude mcp add spring-boot-jersey \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page