Skip to content

Instantly share code, notes, and snippets.

Avatar

Jihun Lee jihlee

  • Mesh Korea
  • Seoul, Korea
View GitHub Profile
@odrotbohm
odrotbohm / StoreRepository.java
Last active Jul 2, 2020
Dynamic, Querydsl-based filter bindings using Spring Data REST
View StoreRepository.java
public interface StoreRepository extends PagingAndSortingRepository<Store, String>,
QueryDslPredicateExecutor<Store>, QuerydslBinderCustomizer<QStore> {
@RestResource(rel = "by-location")
Page<Store> findByAddressLocationNear(Point location, Distance distance, Pageable pageable);
default void customize(QuerydslBindings bindings, QStore store) {
bindings.bind(store.address.city).single((path, value) -> path.startsWith(value));
bindings.bind(String.class).single((StringPath path, String value) -> path.contains(value));
}
You can’t perform that action at this time.