Seed project for Jersey2 REST API with Spring dependency injection
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
gradle/wrapper
project-api
project-model
project-service
.gitignore
.travis.yml
LICENSE
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

jersey2-spring-seed-project

Build Status Coverage Status

Seed project to create REST API using Jersey2 and Spring Framework for dependency injection.

  • Spring beans and dependencies are configured using annotations.
  • Database access via Spring Data/JPA/Hibernate
  • Gradle as build management
  • Testng with hsqldb for unit testing.

This also comes with a gradle task to aggregate unit test coverage from subprojects:

  • gradle jacocoRootReport

#full tech stack

  • Java 1.7
  • Jersey 2.22.1
  • Spring 4.2.2
  • Spring Data/JPA 1.9.0
  • PostGreSQL 9.4.5
  • Gradle 2.2.1
  • TestNG 6.9.4
  • HSQLDB 2.3.3

#setup

  • Rename subprojects project-* to yourproject name i.e: project-api --> fantastic-api
  • Rename the default package com.project to com.your-company
  • Update gradle.settings with new project names
  • Update web.xml with new package names
  • Ensure JNDI resource exists in $TOMCAT_HOME/conf/server.xml:
<Resource name="jndiDBresource"
        auth="Container"
        type="javax.sql.DataSource"
        username="postgres"
        password=""
        driverClassName="org.postgresql.Driver"
        url="jdbc:postgresql://localhost:5432/postgres"
        maxTotal="25"
        maxIdle="10"
        validationQuery="select 1" />