Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's new in Spring Data Release Fowler & Gosling?

What's new in Spring Data Release Fowler & Gosling?

Christoph Strobl

November 04, 2015
Tweet

More Decks by Christoph Strobl

Other Decks in Programming

Transcript

  1. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Intro 2
  2. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data 3 Abstraction relational non-relational JDBC* MongoDB Neo4j JPA* Redis Couchbase Cassandra Solr Spring Data
  3. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 4 Core KeyValue Gemfire JPA Solr Elasticsearch Cassandra Couchbase Redis MongoDB Community
 modules Core
 modules Neo4j REST Foundational Store modules Web APIs
  4. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The anatomy of a Spring Data module 5 where needed where needed where reasonable Templates Object mapping Repositories Spring Container Integration CDI Support
  5. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 01 – Introduction 6
  6. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data repositories • Concept of Domain Driven Design • Pragmatic data access API • Interface based programming model • Base abstractions • Query derivation • Pagination, sorting, streaming • Custom queries • Custom repository implementations 7
  7. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data
 Gosling / Fowler 8
  8. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Dependencies 9
  9. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Release train – Spring Framework baselines 10 Gosling Evans Dijkstra Fowler March 2015 August 2014 September 2015 May 2014 Spring 4.0 Spring 4.0 Spring 4.1 Spring 3.2
  10. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What if 11 ? Hopper Today Spring 4.2 Q4 2016 J… Spring 5 & Java 8 …we released Spring Data
  11. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Dependencies • Upgraded Spring Framework baseline to 4.1 • Guava 18, Jackson 2.6 (to align with Spring IO platform 2.0) • Support for Hibernate 5 and MongoDB Java driver 3.0 • Release train BOM • Makes sure you refer to Spring Data modules in matching versions • E.g. Gosling-RELEASE, Fowler-SR1 12
  12. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 02 – Spring Data release train BOM 13
  13. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Commons 14
  14. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 03 – Enhanced Java 8 support 15
  15. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Enhanced Java 8 support • CompletableFuture and ListenableFuture • Stream as repository return type • Leverages persistence provider specific API in JPA • Non-time-zoned JSR-310 types, ThreeTen back-port 16
  16. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 04 – Simplified custom repositories 17
  17. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Simplified customization of repositories • Registering a custom base class for all repositories was cumbersome • Required custom implementation class, factory and FactoryBean • With Spring Data Gosling all that’s needed is the implementation class • Default factory assumes constructor compatibility and uses reflection • @EnableJpaRepositories(repositoryBaseClass = MyCustomImpl.class) 18
  18. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 05 – Web projections 19
  19. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ProjectionFactory • Interface based proxies for domain objects and maps • Outbound use: dedicated view on an object (incl. enrichments via @Value) • Inbound use: bind request data to strongly typed object backed by a Map 20
  20. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 06 – Querydsl web support 21
  21. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Querydsl web support • Bind request parameters to Predicate • Customize bindings via QuerydslBinderCustomizer 22
  22. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data JPA 23
  23. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 07 – Enhanced JPA 2.1 support 24
  24. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data JPA • Support for @EntityGraph • Support for ad-hoc fetch graphs • Dependency upgrades: EclipseLink 2.6, compatibility with Hibernate 5 • ParameterMode.REF_CURSOR for stored procedures • AttributeConverters for (non-time-zoned) JSR-310 and ThreeTen back-port • Option to disable default transactions 25
  25. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data MongoDB 26
  26. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 08 – MongoDB & Spring Security 27
  27. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 09 – MongoDB & Java 8 28
  28. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data MongoDB • SpEL support for @Query methods for MongoDB. • EvaluationContextProvider -> SPI for custom extension • Spring Security support for MongoDB • MongoDB Java driver 3.0 compatibility • Support for Java 8 Stream as query method return type • Support for calling JavaScript functions • Support for GeoJSON 29
  29. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data REST 30
  30. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 10 – Version headers & conditional requests 31
  31. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 11 – HAL browser & metadata 32
  32. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data REST • Automatic translation of Enum values and link titles • RepositoryEntityLinks to create links to search resources • Support for @Version -> ETag & conditional GETs • @LastModifiedDate -> Last-Modified header • Improved JSON Schema support • HAL Browser • Custom POST form using the schema and JSON Editor • PagedResourcesAssembler exposes first and last links 33
  33. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Redis 34
  34. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 12 – Redis 35
  35. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Redis • Switch to Lettuce fork by Mark Paluch (@mp911de) • Generic JSON object serialization to support polymorphism (Jackson) • Support for ZRANGEBYLEX command 36
  36. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data KeyValue 37
  37. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO 13 – Key-value repositories 38
  38. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data KeyValue • General introduction into the module • Repository abstraction • In-memory based key-value stores • Customizable java.util.Map based implementation • Query derivation via SpEL 39
  39. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook 40
  40. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DEMO Redis mapping & repositories 41
  41. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook • Query augmentation / Spring Security integration • Query by example – for multi-field search forms • Redis object-to-hash mapping • Querydsl 4 • Major store upgrades into the release train • Spring Data Neo4j 4.1 • Spring Data Couchbase 2.0 • Spring Data Solr 2.0 (Solr 5.0) 42
  42. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Related sessions 43
  43. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Related sessions ! • 10:45 – Eberhard Wolff 
 Microservices mit Spring Boot und Spring Cloud • 12:00 – Jürgen Höller
 Modernes Java-Komponentendesign mit Spring 4.2 • 12:00 – Eberhard Wolff & Oliver Gierke
 Integration von Microservices - REST vs Messaging • 16:00 – Oliver Gierke
 Spring Data REST – Repositories meet Hypermedia 44
  44. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Resources 45
  45. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Resources • Slides – TBA • Talk demos – Repository @ GitHub • Spring Data examples – Repository @ GitHub • Spring Data wiki (Release trains, planning) – Wiki • Spring projects release calendar – Subscribable calendar ! • NEW: Find us on Gitter! 46
  46. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Safe Harbor Statement The following is intended to outline the general direction of Pivotal's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of Pivotal offerings, future updates or other planned modifications is subject to ongoing evaluation by Pivotal and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding Pivotal's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for Pivotal's offerings in this presentation remain at the sole discretion of Pivotal. Pivotal has no obligation to update forward looking information in this presentation. 48