Share
Embed
What's new in Spring Data?
Slides of the webinar I gave January 26th.
@springcentral
Oliver Drotbohm
January 26, 2016
Transcript
41 slides
-
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/ 1 What’s new in Spring Data ? / olivergierke Oliver Gierke -
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/ 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 -
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/ Code first Talk demos – Repository @ GitHub Spring Data examples – Repository @ GitHub 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/ Spring Data Gosling / Fowler 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/ Dependencies 6 -
Release train – Spring Framework baselines 7 Evans Dijkstra August
2014 May 2014 Spring 4.0 Spring 3.2 -
Release train – Spring Framework baselines 7 Evans Dijkstra Fowler
March 2015 August 2014 May 2014 Spring 4.0 Spring 4.0 Spring 3.2 -
Release train – Spring Framework baselines 7 Gosling Evans Dijkstra
Fowler March 2015 August 2014 September 2015 May 2014 Spring 4.0 Spring 4.0 Spring 4.1 Spring 3.2 -
Release train – Spring Framework baselines 8 Gosling Evans Dijkstra
Fowler March 2015 August 2014 September 2015 May 2014 Spring 4.0 Spring 4.0 Spring 4.1 Spring 3.2 -
Release train – Spring Framework baselines 8 Gosling Evans Dijkstra
Fowler March 2015 August 2014 September 2015 May 2014 Spring 4.0 Spring 4.0 Spring 4.1 Spring 3.2 Hopper March 2016 Spring 4.1 -
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 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/ DEMO 02 – Spring Data release train BOM 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/ Spring Data Commons 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/ DEMO 03 – Enhanced Java 8 support 12 -
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 13 -
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) 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 05 – Web projections 15 -
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 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 06 – Querydsl web support 17 -
Querydsl web support • Bind request parameters to Predicate •
Customize bindings via QuerydslBinderCustomizer 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/ Spring Data JPA 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/ DEMO 07 – Enhanced JPA 2.1 support 20 -
Spring Data JPA • Support for @EntityGraph • Support for
ad-hoc fetch graphs • vote for this ticket to get this into JPA 2.2 • 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 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/ Spring Data MongoDB 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/ DEMO 08 – MongoDB & Spring Security 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 09 – MongoDB & Java 8 24 -
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 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 REST 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 10 – Version headers & conditional requests 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 11 – HAL browser & metadata 28 -
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 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 KeyValue 30 -
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 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/ Outlook 32 -
Outlook • Query by example – for multi-field search forms
• Projections on query methods (DATACMNS-89) • Redis object-to-hash mapping • Querydsl 4 (DATACMNS-640) • 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) 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/ Feedback welcome! 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/ Resources 35 -
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! 36