Spring Data REST: Override repository method on the controller

后端 未结 4 817
暖寄归人
暖寄归人 2020-12-05 10:32

I have the following REST repository, whose implementation is generated at runtime by Spring.

@RepositoryRestResource
public interface FooRepository extends          


        
4条回答
  •  猫巷女王i
    2020-12-05 11:03

    I found a neat solution if you are using Java 8 - just use default methods in interface

    @RepositoryRestResource
    public interface FooRepository extends CrudRepository {
        default  S save(S var1) {
            //do some work here
        }
    }
    

提交回复
热议问题