Download - Today's Spring framework
![Page 1: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/1.jpg)
Today’s Spring frameworkBackbase Inspiration Lab
21 Nov 2013 Zoltan Altfatter
![Page 2: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/2.jpg)
Agenda
Overview of Spring IO platform
Spring Boot
Spring Data
Hypermedia with Spring HATEOAS
CloudFoundry
Demo Application
Q&A
![Page 3: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/3.jpg)
Pivotal Initiative
Spring (including Grails, RabbitMQ, Tomcat, Redis, GemFire)
Cloudfoundry (the open PaaS (Platform as a Service))
Greenplum (analytic data warehouse using Hadoop)
![Page 4: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/4.jpg)
The Spring IO platform
![Page 5: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/5.jpg)
Spring Bootinspired by Dropwizard
takes an opinionated view
convention-over-configuration
make you focus on the application
spring command line tool - run Groovy scripts
Embed Tomcat or Jetty directly
unlike Spring Roo, no code generation
no requirement for XML configuration
![Page 6: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/6.jpg)
Spring Boot Grooy Demo
![Page 7: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/7.jpg)
Spring DataUmbrella project for data access
subprojects: JPA, MongoDB, Redis, Neo4J, GemFire
Community managed subprojects: Elasticsearch, Solr, CouchDB, Riak
Common concept: Repository, following the repository design pattern
Repository, CrudRepository, PagingAndSortingRepository
![Page 8: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/8.jpg)
Spring Data JPApublic interface RestaurantRepository extends CrudRepository<Restaurant, Long>, RestaurantRepositoryCustom { ! Restaurant findByName(String name); ! Page<Restaurant> findByAddressPostcode(String postcode, Pageable pageable); }
interface RestaurantRepositoryCustom { void removeRestaurantWithWebsite(Website website); }
class RestaurantRepositoryImpl implements RestaurantRepositoryCustom { @PersistenceContext private EntityManager em; ! @Override public void removeRestaurantWithWebsite(Website website) { TypedQuery<Restaurant> query = em.createQuery("from Restaurant where website like :website", Restaurant.class); query.setParameter("website", website); em.remove(query.getSingleResult()); } }
![Page 9: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/9.jpg)
Hypermedia with Spring HateoasHATEOAS: Hypermedia As The Engine Of Application State
hyper-text driven REST web services
we are encoding metadata, or hypermedia, along with the repsonse
Resources discoverable through publication of links that point to the available resources
Spring Hateoas: provide an API to simplify the creation of hypermedia links and assembling the REST resource representation
![Page 10: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/10.jpg)
Example hyper-text REST responsecurl -v -H "Accept: application/json" http://localhost:8080/resturants/1
< HTTP/1.1 200 OK < X-Application-Context: application < Content-Type: application/json < Transfer-Encoding: chunked < Server: Jetty(8.1.9.v20130131) < { "name" : "Cafe Olivier", "website" : { "value" : "http://www.cafeolivier.nl" }, "links" : [ { "rel" : "self", "href" : "http://localhost:8080/restaurants/1" }, { "rel" : "address", "href" : "http://localhost:8080/restaurants/1/address" }, { "rel" : "reviews", "href" : "http://localhost:8080/restaurants/1/reviews" } ] }
![Page 11: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/11.jpg)
Spring in the cloud
The deployment targets for modern applications vary considerably
Java EE, Apache Tomcat/Jetty,
Cloud (AWS, Google App Engine, Heroku, OpenShift, CloudFoundry)
CloudFoundry - the open PaaS https://github.com/cloudfoundry
You can install it in your datacenter (cf-vagrant-installer using Chef, recommended way is BOSH)
https://run.pivotal.io
![Page 12: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/12.jpg)
Demo application
![Page 13: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/13.jpg)
Further tasks
Use SQL service (cleardb) provided by CloudFoundry
Store the model in MongoDB using Spring Data
Using profiles switch between datastores on CloudFoundry
Setup local CloudFoundry environment
Add security to REST endpoints
![Page 14: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/14.jpg)
Social coordinates
https://github.com/altfatterz/reviews
https://github.com/altfatterz/spring-boot-groovy
twitter: @altfatterz
blog: altfatterz.blogspot.com
![Page 15: Today's Spring framework](https://reader036.vdocuments.mx/reader036/viewer/2022081518/554a0e2cb4c90507558b4a1f/html5/thumbnails/15.jpg)
Thanks!