I have a following problem. I made an application which uses spring-data and exposes it as a REST service using spring-data-rest. Everything went smooth till I wanted to have a custom implementation. I've created a CustomSomethingRepository and SomethingRepositoryImpl with one additional method. Spring data repository interface extended CustomSomethingRepository and everything was fine, I was able to execute my method from test directly, custom implementation was executed as well. Then I tried to get it through REST api and here I was surprised that this method is not available through /somethings/search . I'm almost hundred percent sure that it worked fine in spring boot 1.3.x and JpaRepositories. Now I'm using boot 1.5.x and MongoRepository. Please take a look at my example code:
@RepositoryRestResource
public interface SomethingRepository extends CrudRepository<Something>, CustomSomethingRepository {
//this one is available in /search
@RestResource(exported = true)
List<Something> findByEmail(String email);
}
and custom interface
public interface CustomSomethingRepository {
//this one will not be available in /search which is my problem :(
List<Something> findBySomethingWhichIsNotAnAttribute();
}
and implementation
@RepositoryRestResource
public class SomethingRepositoryImpl implements CustomSomethingRepository {
@Override
public List<Something> findBySomethingWhichIsNotAnAttribute() {
return new ArrayList<>(); //dummy code
}
}
Could you please give me a hint how can I expose CustomSomethingImpl as a part of Rest endpoint without creating another regular spring mvc bean which will be just handling this single request?
I've read questions like this: Implementing custom methods of Spring Data repository and exposing them through REST which state that this is not possible to achieve, but believe me or not, I had a project with spring-boot 1.3.x and those implementations were exposed as well :).
Thank you!