Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Simple Java WebApp using Spring, Jersey and Hibernate

Notifications You must be signed in to change notification settings

jtuchscherer/cf-jersey-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Spring Web App Starter Project

Build Status

Instructions

Build this project with

mvn clean package

Run integration tests with

mvn clean verify

You can run it with

mvn clean docker:start tomcat7:run

Then you can test the api with curl like this

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -XPOST localhost:8080/rest/users -d '{"name": "tom", "email": "[email protected]", "roles": [{"name": "dev"}]}'

curl -i -H "Accept: application/json" localhost:8080/rest/users

or in the case of running this app on PWS:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -XPOST https://java-starter.cfapps.io/rest/users -d '{"name": "tom1", "email": "[email protected]", "roles": [{"name": "dev"}]}'

curl -i -H "Accept: application/json" https://java-starter.cfapps.io/rest/users

You can push it to CloudFoundry with the following commands

For bosh-lite

mvn clean cf:push -Pbosh-lite (this assumes you have a local bosh-lite install with an org 'Java' and a space 'dev')

For PWS

mvn clean cf:push -PPWS (you will need to modify the org and space in the pom.xml)

In order to get these two commands to work, you will need this in your ~/.m2/settings.xml

<settings>
  [...]
  <servers>
    [...]
    <server>
      <id>bosh-lite</id>
      <username>admin</username>
      <password>admin</password>
    </server>
    <server>
      <id>pws</id>
      <username>PWS_USERNAME</username>
      <password>PWS_PASSWORD</password>
    </server>
  </servers>
</settings>

Notes

  • Uses Jersey 2.12 for REST server
  • Spring 4.1.4.RELEASE (web.xml got replaced by WebAppInitializer)
  • This app uses an embedded HSQL database to store the users and Hibernate as an ORM
  • It sends message to RabbitMQ
  • Logging is provided by logback
  • There are end-to-end integration tests that start an embedded tomcat server and use HttpClient to query the API

About

Simple Java WebApp using Spring, Jersey and Hibernate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages