Use Spring Data REST to upload, store, and manage pictures
Java JavaScript CSS HTML Other
Latest commit 171f867 Dec 11, 2015 @gregturn Update application.yml

README.adoc

Build Status

Note
This snapshot copy is captured from SpringOne 2GX 2015 in Washingon, D.C.

Spring-a-Gram is a demonstration of the Spring stack used to upload and view pictures.

Spring Data REST makes it incredibly simple to define and export data store entities. What does this mean? You declare the POJOs that are stored in your database. In this case, we are using a JPA, in-memory data store. (Spring Data REST supports other data stores as well). You then define a related repository interface. Spring Data REST takes it from there to create a hypermedia-driven, RESTful interface using Spring MVC that lets you create, read, update, and delete data.

This sample application demonstrations how declaring a backend aimed at storing image data can make it as simple as possible to upload pictures and then turn around and display them on a website. This opens the door to other front ends, like an iOS or Android app.

If you want to run it right now, you need:

To download and run:

  1. git clone git@github.com:gregturn/spring-a-gram.git to grab a local copy (or clone your own fork).

  2. bower install to pull down javascript libraries. If you get prompted about jQuery, accept the version specified in bower.json

  3. mvn clean spring-boot:run

Note
To deploy a copy to PWS, you need a Java 8 build pack. Execute cf push spring-a-gram -p target/spring-a-gram-0.1.0.jar -b https://github.com/spring-io/java-buildpack.git and you’ll be set.

This should get the app started courtesy of Spring Boot. Now you can traverse the app from different view points.

  • From the command line, interrogate the API with curl localhost:8080/api. Navigate to the other links.

  • From the desktop, visit http://localhost:8080 to see the Desktop version of the web experience.

  • From a mobile device, visit http://localhost:8080 and see a different flow, optimized for the smaller real estate.