From 327eda15069cf4e5f0e88b1c73799e6550249b12 Mon Sep 17 00:00:00 2001 From: Ben Warfield Date: Mon, 8 Jul 2019 16:43:23 -0400 Subject: [PATCH] DATAREST-1407 - Updated example for customizing resource URLs. Removed the reference to the deprecated RepositoryRestConfigurerAdapter, and updated the entity-lookup/ID translation example to use the currently supported API. Original pull request: #359. --- src/main/asciidoc/customizing-sdr.adoc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/asciidoc/customizing-sdr.adoc b/src/main/asciidoc/customizing-sdr.adoc index 5417ce838..e1f9fbf0e 100644 --- a/src/main/asciidoc/customizing-sdr.adoc +++ b/src/main/asciidoc/customizing-sdr.adoc @@ -19,13 +19,14 @@ On Java 8, we can register the mapping methods as method references to tweak the [source, java] ---- @Component -public class SpringDataRestCustomization extends RepositoryRestConfigurerAdapter { +public class SpringDataRestCustomization extends RepositoryRestConfigurer { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { - - config.withCustomEntityLookup().// - forRepository(UserRepository.class, User::getUsername, UserRepository::findByUsername); + config.withEntityLookup() + .forRepository(UserRepository.class) + .withIdMapping(User::getUsername) + .withLookup(UserRepository::findByUsername); } } ----