diff --git a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterExampleRestConfig.java b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterExampleRestConfig.java index f24cc3723..29abda13a 100644 --- a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterExampleRestConfig.java +++ b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterExampleRestConfig.java @@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.data.rest.config.RepositoryRestConfiguration; import org.springframework.data.rest.example.jpa.Person; +import org.springframework.data.rest.example.jpa.PersonRepository; import org.springframework.data.rest.example.jpa.PersonValidator; import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; import org.springframework.hateoas.Link; @@ -31,14 +32,9 @@ public class RestExporterExampleRestConfig extends RepositoryRestMvcConfiguratio } @Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { - config.addResourceMappingForDomainType(Person.class) + config.setResourceMappingForDomainType(Person.class) .addResourceMappingFor("lastName") .setPath("surname"); - config.addResourceMappingForDomainType(Person.class) - .addResourceMappingFor("siblings") - .setRel("siblings") - .setPath("siblings") - .setExported(false); } @Bean public ResourceProcessor> personResourceProcessor() { diff --git a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterWebInitializer.java b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterWebInitializer.java index 26aab4ba2..b65161dc5 100644 --- a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterWebInitializer.java +++ b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/RestExporterWebInitializer.java @@ -6,7 +6,6 @@ import javax.servlet.ServletRegistration; import org.springframework.data.rest.example.jpa.JpaRepositoryConfig; import org.springframework.data.rest.example.mongodb.MongoDbRepositoryConfig; -import org.springframework.data.rest.example.neo4j.Neo4jRepositoryConfig; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -20,10 +19,10 @@ public class RestExporterWebInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootCtx = new AnnotationConfigWebApplicationContext(); rootCtx.register( - //JpaRepositoryConfig.class, - //MongoDbRepositoryConfig.class, + JpaRepositoryConfig.class, + MongoDbRepositoryConfig.class //GemfireRepositoryConfig.class, - Neo4jRepositoryConfig.class + //Neo4jRepositoryConfig.class ); servletContext.addListener(new ContextLoaderListener(rootCtx)); diff --git a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/jpa/PersonRepository.java b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/jpa/PersonRepository.java index c30b084a0..12e844d98 100644 --- a/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/jpa/PersonRepository.java +++ b/spring-data-rest-example/src/main/java/org/springframework/data/rest/example/jpa/PersonRepository.java @@ -19,18 +19,17 @@ import org.springframework.data.rest.repository.annotation.RestResource; @RestResource(rel = "people", path = "people") public interface PersonRepository extends PagingAndSortingRepository { - @RestResource(rel = "firstname", path = "firstname") - public Page findByFirstName(@Param("firstName") String firstName, Pageable pageable); + @RestResource(rel = "firstname", path = "firstname") + public Page findByFirstName(@Param("firstName") String firstName, Pageable pageable); - public Person findFirstPersonByFirstName(@Param("firstName") String firstName); + public Person findFirstPersonByFirstName(@Param("firstName") String firstName); - public Page findByCreatedGreaterThan(@Param("date") Date date, Pageable pageable); + public Page findByCreatedGreaterThan(@Param("date") Date date, Pageable pageable); - @Query("select p from Person p where p.created > :date") - public Page findByCreatedUsingISO8601Date(@Param("date") - @ConvertWith( - ISO8601DateConverter.class) - Date date, - Pageable pageable); + @Query("select p from Person p where p.created > :date") + public Page findByCreatedUsingISO8601Date(@Param("date") + @ConvertWith(ISO8601DateConverter.class) + Date date, + Pageable pageable); }