Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zenixls2/springbootexample
steps to build up a spring-boot + Jersey project
https://github.com/zenixls2/springbootexample
groovy jersey2 spring-boot
Last synced: 25 days ago
JSON representation
steps to build up a spring-boot + Jersey project
- Host: GitHub
- URL: https://github.com/zenixls2/springbootexample
- Owner: zenixls2
- License: apache-2.0
- Created: 2017-06-05T12:06:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T12:09:32.000Z (over 7 years ago)
- Last Synced: 2024-10-15T09:51:06.038Z (3 months ago)
- Topics: groovy, jersey2, spring-boot
- Language: Groovy
- Size: 56.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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__:```bash
spring init -d=jersey --build=gradle --lang=groovy app```
- __Create Config__
```groovy
package com.example.appimport org.springframework.context.annotation.Configuration
import org.glassfish.jersey.server.ResourceConfig@Configuration
class JerseyConfig extends ResourceConfig {
def JerseyConfig() {
return register(TestResource.class);
}
}
```- __Add Resource__
```groovy
package com.example.appimport 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__:
```bash
cd app
./gradlew bootRun
```- __List Built Components__:
```bash
cd app
./gradlew components
```- __Build__:
```bash
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
```