Skip to content

zenixls2/springBootExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-Boot + Jersey Example with Spring-CLI


These are the first steps of creating a spring-boot project. However, even compiled into jar files, the cold start time still takes long After about 140,000 requests, the service response time would become stable.

If you are still a spring framework user, be sure to switch to Akka framework and give it a try.

Build Steps

  • Generate:
spring init -d=jersey --build=gradle --lang=groovy app
  • Create Config
package com.example.app

import org.springframework.context.annotation.Configuration
import org.glassfish.jersey.server.ResourceConfig

@Configuration
class JerseyConfig extends ResourceConfig {
    def JerseyConfig() {
        return register(TestResource.class);
    }
}
  • Add Resource
package com.example.app

import javax.ws.rs.GET
import javax.ws.rs.Produces
import javax.ws.rs.Pah

@Path("/")
class TestResource {
    @GET
    @Produces("text/plain")
    def String getMessage() {
        return "Hello World!";
    }
}
  • Test Run:
cd app
./gradlew bootRun
  • List Built Components:
cd app
./gradlew components
  • Build:
cd app
./gradlew bootRepackage
# The result jar resides in build/libs/*
# you could run java -jar on such file directly for execution
# and be easier to deploy to other places

About

steps to build up a spring-boot + Jersey project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages