RESThub Spring Stack

Presentation

RESThub 2 Spring stack provides a server side full stack and guidelines for building Java/Spring application (usually web application, but not only).

It provides a coherent stack based on:

It provides the following modules:

  • resthub-archetypes: project templates (WAR or multi-module layout) to start quickly a new project
  • resthub-jpa: support for JPA based persistence based on Spring Data, including embedded H2 database for testing
  • resthub-mongodb: support for MongoDB based on Spring Data
  • resthub-test: testing stack based on TestNG, Mockito and Fest Assert 2
  • resthub-web-server: generic REST webservices support based on Spring MVC 4.1.1 including exception mapping to HTTP status codes
  • resthub-web-client: simple to use HTTP client based on AyncHttpClient

Released artifacts are available from Maven Central and will be automatically found without adding any additional repository.

Snapshot artifacts are available from Sonatype OSS Snapshot repository. In order to use it for your projects, you should add the following element to your pom.xml :

<repositories>
    <repository>
        <id>snapshot</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Versions & Changelogs

Spring stack current version is 2.2.0, the whole RESThub 2.2 Spring stack Javadoc is available.

You can find RESThub Spring Stack release changelogs here

Bootstrap your project

Java and Maven 3 should be installed on your computer. RESThub based applications are usually developed thanks to a Java IDE like Eclipse, Netbeans or IntelliJ IDEA. If you don’t know which IDE to choose, Netbeans is recommended since it is free and has great Maven support and Java/Javascript capabilities.

The easiest way to start is to use RESThub archetypes to create your first web application.

You will have to choose between the following RESThub archetypes:

  • resthub-jpa-backbonejs-archetype: simple HTML5 web application with JPA persistence
  • resthub-mongodb-backbonejs-archetype: simple HTML5 web application with MongoDB persistence
  • resthub-jpa-backbonejs-multi-archetype: Multimodules HTML5 web application with JPA persistence
  • resthub-mongodb-backbonejs-multi-archetype: Multimodules HTML5 web application with MongoDB persistence

To create your project based or RESThub archetypes, just open a command line terminal, and copy/paste the line related to the archetype you chosed:

mvn archetype:generate -DarchetypeArtifactId=resthub-jpa-backbonejs-archetype -DarchetypeGroupId=org.resthub -DarchetypeVersion=2.2.0
mvn archetype:generate -DarchetypeArtifactId=resthub-mongodb-backbonejs-archetype -DarchetypeGroupId=org.resthub -DarchetypeVersion=2.2.0
mvn archetype:generate -DarchetypeArtifactId=resthub-jpa-backbonejs-multi-archetype -DarchetypeGroupId=org.resthub -DarchetypeVersion=2.2.0
mvn archetype:generate -DarchetypeArtifactId=resthub-mongodb-backbonejs-multi-archetype -DarchetypeGroupId=org.resthub -DarchetypeVersion=2.2.0

After choosing the right archetype and answering a few questions, your project is generated and ready to use. You can run it thanks to built-in Jetty support:

mvn jetty:run

Tutorial

You can also discover more concretly RESThub Spring Stack with our dedicated tutorial. Available with or without answers : here