spring-data-rest发布的自定义jpa存储库方法

我已经在jpa存储库中添加了一个自定义方法,详见http://docs.spring.io/spring-data/data-jpa/docs/1.0.x/reference/html/#repositories.custom-implementations

据我所知,当我使用spring-data-rest时,这个方法不会暴露。 有没有什么办法可以将它作为spring-data-rest生成的REST API的一部分发布(不用自己创建Spring MVC Controller)?

我检查了代码库 – 似乎他们已经明确禁用自定义方法 – 不知道为什么。 以下是org.springframework.data.repository.core.support.DefaultRepositoryInformation的相关代码。

@Override public Set getQueryMethods() { Set result = new HashSet(); for (Method method : getRepositoryInterface().getMethods()) { method = ClassUtils.getMostSpecificMethod(method, getRepositoryInterface()); if (isQueryMethodCandidate(method)) { result.add(method); } } return Collections.unmodifiableSet(result); } /** * Checks whether the given method is a query method candidate. * * @param method * @return */ private boolean isQueryMethodCandidate(Method method) { return isQueryAnnotationPresentOn(method) || !isCustomMethod(method) && !isBaseClassMethod(method); }