What's New in Spring Data?
-
Upload
spring-io -
Category
Technology
-
view
254 -
download
1
Transcript of What's New in Spring Data?
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
What’s New in Spring Data?Mark Paluch • Christoph Strobl
@mp911de • @stroblchristoph
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 2
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Agenda
3
Overview Core Themes
Store modules Q&A
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Hopper Release
4
imag
e so
urce
: ht
tps:
//com
mon
s.w
ikim
edia
.org
(Lic
ense
: CC
0)
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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>
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Module setup Hopper
6
Commons
Neo4j Gemfire
JPA
Solr
ElasticSearch
REST
CassandraCouchbase
Redis
MongoDB
Communitymodules
Coremodules
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Core Themes
9
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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())
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Demo
11
Query by Example
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 13
DemoProjections
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 15
DemoComposed Annotations
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 16
DemoWrapped Parameters
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Store Specifics
17
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 19
DemoRedis Cluster
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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: { ...
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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" } }
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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 { //… }
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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); }
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Spring Data Elasticsearch
• Upgrade to Elasticsearch 2 • Removed Facet feature -> Please use Aggregations instead.
24
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Outlook - Ingalls
25
imag
e so
urce
: ht
tps:
//com
mon
s.w
ikim
edia
.org
(Lic
ense
: CC
0 BY
-SA
3.0)
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Module setup Hopper
26
Commons
Neo4j Gemfire
JPA
Solr
ElasticSearch
REST
CassandraCouchbase
Redis
MongoDB
Communitymodules
Coremodules
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Module setup Ingalls
27
Commons
Neo4j Gemfire
JPA
Solr
ElasticSearch
REST Cassandra
Couchbase
Redis
MongoDB
Communitymodules
Coremodules
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Oh, wait - one more thing
29
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
..maybe you’ve heard of Reactive Programming
30
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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 !
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 / 32
DemoReactive Data Access
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Related Sessions• Tue, 2nd, August, 2016
• 3:20 pm – Christoph StroblSpring Data Redis Cluster & Repositories
"• Wed, 3rd, August, 2016
• 2:00 pm – Sébastien Deleuze, Stéphane MaldiniA Lite Rx API for the JVM
• Wed, 3rd, August, 2016 • 3:20 pm – John Blum, Mark Paluch
Outlook: Spring Data Cassandra 1.5
33
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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 GierkeAdvanced Spring Data REST
"• Thu, 4th, August, 2016
• 11:45 am – Viktor Gamov, Neil Stevenson Spring Data Hazelcast: Fluently Accessing Distributed Repositories
34
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /by -nc /3 .0 /
Feedback welcome!
35
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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
Unless o therwise ind ica ted , these s l ides a re © 2013-2016 P ivo ta l So f tware , Inc . and l i censed under a Creat ive Commons At t r ibu t ion -NonCommerc ia l l i cense : h t tp : / /c rea t ivecommons .org / l i censes /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