You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry, I don't mean to post the same issue here as well as on Stackoverflow, but I did not know I could post issues under spring-projects/spring-boot.
I am trying to do something a little interesting where I want to be able to dynamically build sql query filters using Spring Boot 1.5.9 and Spring Data Rest without needing to write a controller. I feel like I might be on the right path, but I am kinda stuck.
The idea is to intercept an HTTP Request GET method by using HandlerInterceptorAdapter and store the Request query parameters into an object that can be used by the PagingAndSortingRepository. The plan is to override findAll(Pageable p) that Spring Data Rest uses by default, to call findAll(Specification s, Pageable p) to allow dynamic filtering.
I have used Request Scope provided by Spring to save the query parameters to allow me to use them throughout the life cycle of the Request.
Spring Data Rest tries to create an endpoint by trying to build a SQL query based on the function name. Even when I tried to get around this issue by trying to trick Spring Data by creating a function that it can query with then overriding it with SampleRepositoryComponents that I implemented below, I cannot get the data stored in QueryParam.
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow where your question is only 30 minutes old. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.
Sorry, I should have waited a little longer, but there are clarifications that I need because I am not really sure if they are bugs or not. There are three issues and I am unsure if I would be able to get an answer from Stack Overflow and I haven't seen this in the Spring Documentation. If it is feasible, I do want to see if they can become enhancements.
I am trying to figure out if Spring dependency injections in interface files are actually possible. If it is actually possible and it's an intended behavior, is this supposed to work in the Repository interface file based on the second link in the original post?
I am also trying to figure out if Spring Data Rest is currently implemented to not allow ignoring of methods in the Repository interface.
Does Spring Data Rest use interface implementations with overrides that you have annotated as a component? The reason why this one is also important is because the solution in the second link in the original post seems to also imply that it's supposed to work, but it doesn't work.
Sorry, I don't mean to post the same issue here as well as on Stackoverflow, but I did not know I could post issues under spring-projects/spring-boot.
I am trying to do something a little interesting where I want to be able to dynamically build sql query filters using Spring Boot 1.5.9 and Spring Data Rest without needing to write a controller. I feel like I might be on the right path, but I am kinda stuck.
The idea is to intercept an HTTP Request GET method by using HandlerInterceptorAdapter and store the Request query parameters into an object that can be used by the PagingAndSortingRepository. The plan is to override findAll(Pageable p) that Spring Data Rest uses by default, to call findAll(Specification s, Pageable p) to allow dynamic filtering.
I have used Request Scope provided by Spring to save the query parameters to allow me to use them throughout the life cycle of the Request.
The problem is that I cannot access the QueryParam object from the Repository interface file. I tried to use dependency injection into the interface file, by following this stackoverflow solution, but it does not work: https://stackoverflow.com/questions/13815139/spring-dependency-injection-for-interfaces
Spring Data Rest tries to create an endpoint by trying to build a SQL query based on the function name. Even when I tried to get around this issue by trying to trick Spring Data by creating a function that it can query with then overriding it with SampleRepositoryComponents that I implemented below, I cannot get the data stored in QueryParam.
Someone else also made a pull request to allow Spring Data Rest to ignore certain methods: spring-projects/spring-data-rest#286
QueryParam:
SampleRepository:
QuerySpecification:
SampleRepositoryComponents:
The text was updated successfully, but these errors were encountered: