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.
This commit is contained in:
Ben Warfield
2019-07-08 16:43:23 -04:00
committed by Oliver Drotbohm
parent 02b8c53ad4
commit 327eda1506

View File

@@ -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);
}
}
----