Basic Gradle v6.7.1 multi-source-set project setup for Spring Boot with Jersey (JAX-RS) web applications.
The project skeleton helps to be up and running quickly without wasting too much time on setting up & wiring things from scratch. Also, it serves as a refresher for basic things like:
- Gradle project setup boiler plate
- Configuring Spring Boot & Jersey (FYI: Using Jersey is not a
must. Spring MVC is a more native choice when using Spring Framework) - Writing a unit test using a JUnit 4.x.x
- Writing a unit test using mocks (i.e.: Mockito runner)
- Writing a Spring Boot based tests (i.e.: tests annotated with
@SpringBootTest)
- Spring Boot version:
v2.3.5.RELEASE /api/*is the Jersey base path that serves as the base URI for all resource URIs provided by@Path
- Command
./gradlew bootRunstarts Tomcat on port8080 - The following
RESTfulAPIs are available upon service start-up:GEThttp://localhost:8080/api/v1/greetingsGEThttp://localhost:8080/api/v1/greetings/{id}(choose anidfrom1,2or3)POSThttp://localhost:8080/api/v1/greetingscurl -H "Content-Type:application/json"-X POST --data '{"text": "Privet!"}' http://lcalhost:8080/api/v1/greetings
- Spring Boot Actuator exposes two APIs:
http://localhost:8080/actuator/healthhttp://localhost:8080/actuator/metrics
- Command
./gradlew testruns unit tests - Command
./gradlew componentTestruns component tests
MIT. See LICENSE for details