DATAREST-216 - CrudRepositoryInvoker considers redeclared methods correctly.

CrudRepositoryInvoker now detects re-declared CRUD methods and falls back to reflection invocation if the re-declaration is detected.

Inspired by PR #126 by Nick Weedon but avoiding the introduction of a dependency to Spring Security by using a more precise testing approach.

Original pull request: #126.
This commit is contained in:
Oliver Gierke
2014-02-13 10:28:19 +01:00
parent 4508bc094a
commit 5dd33ba7c0
5 changed files with 48 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.springframework.data.rest.core.domain.jpa;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@@ -27,7 +28,7 @@ import javax.persistence.Table;
@Table(name = "ORDERS")
public class Order {
private @Id Long id;
private @Id @GeneratedValue Long id;
private @ManyToOne Person creator;
public Order(Person creator) {

View File

@@ -22,4 +22,17 @@ import org.springframework.data.repository.CrudRepository;
*/
public interface OrderRepository extends CrudRepository<Order, Long> {
/*
* (non-Javadoc)
* @see org.springframework.data.repository.CrudRepository#save(java.lang.Object)
*/
@Override
public <S extends Order> S save(S entity);
/*
* (non-Javadoc)
* @see org.springframework.data.repository.CrudRepository#findOne(java.io.Serializable)
*/
@Override
public Order findOne(Long id);
}