Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What's New in Spring Data?

619 views

Published on

SpringOne Platform 2016
Speakers: Mark Paluch; Spring Data Engineer. Christoph Strobl; Spring Data Committer, Pivotal

This talk will give a broad overview of the new features introduced in the latest Spring Data release trains. We will cover recent additions and improvements in Spring Data Commons - the module that's shared amongst the store specific ones. We'll then delve into the latest and greatest features of individual store modules, like JPA, MongoDB, Redis, and the community ones as well.

Published in: Technology
  • Be the first to comment

What's New in Spring Data?

  1. 1. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What’s New in Spring Data? Mark Paluch • Christoph Strobl @mp911de • @stroblchristoph
  2. 2. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 2
  3. 3. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Agenda 3 Overview Core Themes Store modules Q&A
  4. 4. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Hopper Release 4 imagesource:
 https://commons.wikimedia.org(License:CC0)
  5. 5. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Release train BOM 5 <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-releasetrain</artifactId> <version>Hopper-SR2</version> <scope>import</scope> <type>pom</type> </dependency>
  6. 6. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Module setup Hopper 6 Commons Neo4j Gemfire JPA Solr ElasticSearch REST CassandraCouchbase Redis MongoDB Community
 modules Core
 modules
  7. 7. Unless otherwise indicated, these slides are © 2013-2016 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 7 DijkstraMay 2014 Spring 3.2 EvansAugust 2015 Spring 4.0 FowlerMarch 2015 Spring 4.0 GoslingSeptember 2015 Spring 4.1 HopperApril 2016 Spring 4.2 Ingalls*2016 Spring 4.2
  8. 8. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Major Dependency upgrades for Hopper • Upgraded Spring Framework baseline to 4.2 • Upgrade to Querydsl 4 • Upgrade to Elasticsearch 2.0 • Upgrade to Solr 5 8
  9. 9. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Core Themes 9
  10. 10. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Query by Example • Value objects provided by Spring Data Commons • Supported by Spring Data JPA and Spring Data MongoDB 10 Example<User> example = Example.of( " " " ); " " repository.findAll(example); new User("jon", "snow"), ExampleMatcher.matching() .withMatcher("lastname", matcher -> matcher.ignoreCase().startsWith())
  11. 11. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo 11 Query by Example
  12. 12. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Projections in Repository Query Methods • First time seen with Evans in Spring Data REST • Projections to reduce or enhance view of resources 12 interface CustomerProjection { " String getFirstname(); " } interface CustomerSummary { " @Value( "#{target.firstname + ' ' + target.lastname}") String getFullName(); @Value("#{@mybean.someMethod(target)}") String getSomeCalculatedValue(); " } Closed Projection Open Projection
  13. 13. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 13 Demo Projections
  14. 14. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Commons • Support for Composed Annotations • Support JDK 8 and Guava Optional on repository query parameters • Allow aliasing of Querydsl web bindings • Converter support for JSR-310's ZoneId. 14
  15. 15. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 15 Demo Composed Annotations
  16. 16. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 16 Demo Wrapped Parameters
  17. 17. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Store Specifics 17
  18. 18. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Redis " • Deprecated jredis and srp drivers • Redis Cluster support (Jedis & Lettuce) • Support for object mapping and repositories • Redis SSL support 18
  19. 19. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 19 Demo Redis Cluster
  20. 20. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ • Customizable entity lookup. self: { href: "http://localhost:8080/countries/47631a38-548f-11e6-beb8-9e71128cae77" }, Spring Data REST 20 @Component class SpringDataRestCustomization extends 
 RepositoryRestConfigurerAdapter { " @Override public void 
 configureRepositoryRestConfiguration( RepositoryRestConfiguration config) { " config.withCustomEntityLookup(). forRepository(CountryRepository.class, Country::getName, 
 CountryRepository::findByName); } } countries: [{ name: "austria", _links: { self: { href: "http://localhost:8080/countries/austria" }, country: { href: "http://localhost:8080/countries/austria" } } }, { name: "germany", _links: { ...
  21. 21. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ • Customizable reference entity lookup. Spring Data REST 21 @Component class SpringDataRestCustomization extends 
 RepositoryRestConfigurerAdapter { " @Override public void 
 configureRepositoryRestConfiguration( RepositoryRestConfiguration config) { " config.withCustomEntityLookup(). forLookupRepository(CountryRepository.class). withIdMapping(Country::getName). withLookup(CountryRepository::findByName); } } { "zipCode" : "…", "country" : "Germany" } "_links" { "country" : { "href" : "http://localhost:8080/countries/47631a38-548f-11e6-beb8-9e71128cae77" } }
  22. 22. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Gemfire • Support for OQL specific features via 
 Annotations • @Trace • @Limit 22 • Annotation based eviction strategies • @TimeToLiveExpiration • @IdleTimeout interface UserRepository
 extends GemfireRepository { @Trace @Limit(5) @Hint("UsernameIdx") List<User> findByUsernameLike(String username); } @TimeToLiveExpiration( timeout="300", action="LOCAL_DESTROY") @IdleTimeoutExpiration( timeout="120", action="LOCAL_INVALIDATE") class DomainObject { //… }
  23. 23. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Couchbase • N1QL Integration. • SQL extension for JSON. • Allows sorting and Paging. • Evaluates your SpEL expressions
 and named parameters. 23 • Geospatial query support 
 via specialized Views • Support for auditing annotations. interface PartyRepository extends Repository<Party, String> { @Dimensional( designDocument="partyGeo", spatialViewName="byLocation") List<Party> findByLocNear(Point p, Distance d); } interface UserRepository extends Repository<User, String> { " List<User> findByUsernameContains(String s); @Query List<User> findByAgeBetween(int min, int max); }
  24. 24. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Elasticsearch • Upgrade to Elasticsearch 2 • Removed Facet feature -> Please use Aggregations instead. 24
  25. 25. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook - Ingalls 25 imagesource:
 https://commons.wikimedia.org(License:CC0BY-SA3.0)
  26. 26. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Module setup Hopper 26 Commons Neo4j Gemfire JPA Solr ElasticSearch REST CassandraCouchbase Redis MongoDB Community
 modules Core
 modules
  27. 27. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Module setup Ingalls 27 Commons Neo4j Gemfire JPA Solr ElasticSearch REST Cassandra Couchbase Redis MongoDB Community
 modules Core
 modules
  28. 28. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Outlook • Upgrade to Cassandra 3.0 " • Performance improvements • General: Method handles for property access in object mapping. • MongoDB: DBRef loading improvements. • Couchbase: Async API usage for view based queries.
 • Redis • Partial updates in Redis repositories. • Support for GEO commands and derived findBy…Near/Within queries. " • MongoDB • Aggregation Framework improvements. • $min / $max support in MongoDB.
 • REST: • Support for inbound projections using JSONPath / XPath (via XMLBeam). • Support for VND Error and RFC7807 (Problem details for HTTP APIs). • Support for additional hypermedia formats (Siren, Affordances). 28
  29. 29. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Oh, wait - one more thing 29
  30. 30. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ..maybe you’ve heard of Reactive Programming 30
  31. 31. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data 2.0 • Upgrade JDK baseline to 8 • Upgrade Spring Framework baseline to 5.0 • Reactive support for MongoDB, Redis and Couchbase • Store implementations using either RxJava or Project Reactor • Reactive wrapper type conversion on Repository level 31 ! STAY TUNED !
  32. 32. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 32 Demo Reactive Data Access
  33. 33. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Related Sessions • Tue, 2nd, August, 2016 • 3:20 pm – Christoph Strobl
 Spring Data Redis Cluster & Repositories " • Wed, 3rd, August, 2016 • 2:00 pm – Sébastien Deleuze, Stéphane Maldini
 A Lite Rx API for the JVM
 • Wed, 3rd, August, 2016 • 3:20 pm – John Blum, Mark Paluch
 Outlook: Spring Data Cassandra 1.5
 33
  34. 34. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Related Sessions • Thu, 4th, August, 2016 • 9:00 am – John Blum, Luke Shannon 
 Spring Data and In-Memory Data Management in Action " • Thu, 4th, August, 2016 • 11:10 am – Oliver Gierke
 Advanced Spring Data REST " • Thu, 4th, August, 2016 • 11:45 am – Viktor Gamov, Neil Stevenson 
 Spring Data Hazelcast: Fluently Accessing Distributed Repositories
 34
  35. 35. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Feedback welcome! 35
  36. 36. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Resources • Slides – TBA • Spring Data Examples – Repository @ Github • Spring Data wiki (Release trains, planning) – Wiki • Spring projects release calendar – Google Calendar " • Chat with us on Gitter! 36
  37. 37. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Learn More. Stay Connected. Follow us @SpringData @springcentral spring.io/blog @pivotal pivotal.io/blog @pivotalcf http://engineering.pivotal.io Talk to us spring-projects/spring-data
  38. 38. Unless otherwise indicated, these slides are © 2013-2016 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. 38

×