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

5,715 views

Published on

Speakers: Thomas Darimont, Oliver Gierke, Christoph Strobl
Data / Integration Track

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, Neo4j, Solr and the community ones as well.

Published in: Software
  • Writing good research paper is quite easy and very difficult simultaneously. It depends on the individual skill set also. You can get help from research paper writing. Check out, please ⇒ www.HelpWriting.net ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ♥♥♥ http://bit.ly/2F4cEJi ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❤❤❤ http://bit.ly/2F4cEJi ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

What's new in spring data

  1. 1. What’s new in Spring Data? Oliver Gierke - Thomas Darimont - Christoph Strobl © 2014 SpringOne 2GX. All rights reserved. Do not distribute without permission.
  2. 2. Agenda Overview Repositories Store modules Q&A
  3. 3. Release train
  4. 4. Release train ! • Release coordination effort make sure modules are compatible • Reduce different versions into a single canonical name to refer to Arora 03/2013 Babbage 09/2013 Codd 02/2014 Dijkstra 05/2014 Evans 09/2014
  5. 5. Spring Data Modules Core JPA MongoDB Neo4j Solr Gemfire Redis Elasticsearch REST Couchbase Cassandra Core modules Community modules
  6. 6. Module setup - Codd Core JPA MongoDB Neo4j Solr Gemfire Redis Elasticsearch REST Couchbase Cassandra Core modules Community modules
  7. 7. Module setup - Dijkstra / Evans Core JPA MongoDB Neo4j Solr Gemfire Redis Elasticsearch REST Couchbase Cassandra Core modules Community modules
  8. 8. Evans GA! Hooray! o/
  9. 9. Spring Data Evans - Major themes • Upgrade to Spring 4.0 • Support for top/first keywords in derived queries • Support for MongoDB 2.6 features like text search • SpEL support for Spring Data JPA (Spring Security integration) • Redis Sentinel support • ALPS and excerpt projections for Spring Data REST • Improved multi-store configuration • Asciidoctor for reference documentation
  10. 10. Spring Data Repositories Pragmatic data access APIs
  11. 11. Multi-store configuration We know what you were thinking!
  12. 12. Improved multi-store configuration ! • Triggered if multiple Spring Data modules are detected • Modules only register for interfaces that a assigned to the store • Annotations on domain types (@Entity, @Document) • Store specific repository base interface (not recommended)
  13. 13. Debug output … DEBUG … - Multiple Spring Data modules found, entering strict repository configuration mode! ! … DEBUG … - Spring Data JPA - Could not safely identify store assignment for repository candidate interface ….OrderRepository. ! … DEBUG … - Spring Data JPA - Registering repository: Interface: ….CustomerRepository Factory: ….JpaRepositoryFactoryBean
  14. 14. Query methods
  15. 15. Slices Paging without the overhead
  16. 16. Slices ! • Pagination • Additional query to calculate the total number of elements ! • Slices • Reads one more element than necessary to find out about presence of next slice (optional) • Store-specific optimization
  17. 17. (Optional) support No more NullPointerExceptions with Java 8 or Guava
  18. 18. Default methods
  19. 19. Slices and Optional example interface SampleRepository implements Repository<User, Long> { Slice<User> findByLastname(String lastname, Pageable page); ! Optional<User> findByEmailAddress(EmailAddress email); ! Optional<User> findByLastname(String lastname); ! default Optional<Customer> findByLastname(Customer c) { return findByLastname(c == null ? null : c.lastname); } }
  20. 20. Limiting result sets You’r only interested in the top ones anyway, right?
  21. 21. Limiting result sets ! • Previous options • Use Pageable/Page to dynamically restrict results • Additional keywords to statically restrict results interface SampleRepository implements Repository<User, Long> { List<User> findTop10ByNameLike(String name, Sort sort); }
  22. 22. Derived delete queries
  23. 23. Demo
  24. 24. Miscellaneous
  25. 25. CDI improvements Eager instantiation and custom implementations
  26. 26. Common geo-spatial types
  27. 27. NullsFirst / NullsLast
  28. 28. Store module improvements
  29. 29. JPA Java Persistence API 2.1 support
  30. 30. JPA Improvements ! • JPA 2.1 support • Execution of stored procedures • Support for entity graph definitions ! • Integration with Spring Security • Out of the box support coming with Spring Security 4.1
  31. 31. Demo
  32. 32. MongoDB
  33. 33. Aggregation go on with system variables
  34. 34. Aggregation Framework ! • System Variables • $$ROOT • $$CURRENT Aggregation aggregation = Aggregation.newAggregation( group(„foo"). push(Aggregation.ROOT).as("users"));
  35. 35. Query Modifiers Alter query behavior
  36. 36. Query Modifiers • Define output and behavior of query • $comment • $maxTimeMS • … interface SampleRepository implements Repository<User, Long> { @Meta(comment=“s2gx2014”) List<User> findByFirstname(String firstname); }
  37. 37. Full $text search Simple - Powerful - Easy
  38. 38. Text Search ! • Supported since MongoDB 2.6 • Multiple stemmers • Different languages interface SampleRepository implements Repository<User, Long> { List<User> findAllBy(TextCriteria criteria); }
  39. 39. Redis
  40. 40. SCAN The non-blocking alternative
  41. 41. SCAN Support • Non-blocking alternative • KEYS • SMEMBERS Cursor<String> keys = redisConnection.scan(); ! while(cursor.hasNext()) { cursor.next(); }
  42. 42. Sentinel Monitoring & failover for your cluster
  43. 43. Sentinel Support ! • Monitoring and failover • Currently only available using Jedis @Bean public RedisSentinelConfiguration sentinelConfig() { return new RedisSentinelConfiguration().master("mymaster") .sentinel("localhost", 26379) .sentinel("localhost", 26380); }
  44. 44. Sentinel support Redis
  45. 45. Sentinel support Redis Redis Redis
  46. 46. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  47. 47. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  48. 48. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  49. 49. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  50. 50. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  51. 51. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  52. 52. Sentinel support Redis Redis Redis Sentinel Sentinel Sentinel
  53. 53. Solr
  54. 54. Deep pagination Go deep at top speed
  55. 55. Deep pagination ! • Performance boost when going deep • Uses cursor Cursor<User> cursor = template.queryForCursor(q, User.class); ! while(cursor.hasNext()) { User user = cursor.next(); }
  56. 56. Schema Support Client side schema management
  57. 57. Schema Support ! • Usage of Schema Solr REST API • Add new fields to existing schema. @Configuration @EnableSolrRepositories(schemaCreationSupport = true) class SolrConfiguration { ! }
  58. 58. Spring Data REST
  59. 59. Spring Data REST • Implements common patterns on top of repositories • Collection / item resources • Association resources • Search resources • Leverages hypermedia and internet standards • URI Templates (RFC 6570) • application/hal+json • text/uri-list (RFC 2483) • profile link relation (RFC 6906)
  60. 60. ALPS support & excerpt projections ! • Application Level Profile Semantics • Spring Data REST exposes resources describing the service ! • Interface-based programming model to define custom projections • Configuration to define excerpt projections
  61. 61. Demo
  62. 62. Related talks
  63. 63. Spring Data Related Talks • Cassandra / Couchbase - Tue, 4:30 pm • Cassandra, Couchbase and Spring Data in the Enterprise • Spring Data BOF - Tue, 9:00 pm • REST - Wed, 8:30 am • Spring Data REST - Data Meets Hypermedia • Neo4j - Wed, 10:30 am • Artistic Spring Data Neo4j 3.0 with Spring Boot and Van Goch • GORM - Wed, 12:45 pm • Advanced GORM – Beyond Relational
  64. 64. Sample code https://github.com/SpringOne2GX-2014/whats-new-in-spring-data
  65. 65. Questions?

×