Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@
<dependency>
<groupId>net.kaczmarzyk</groupId>
<artifactId>specification-arg-resolver</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/tratif/example/web/CustomerController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.tratif.example.domain.Customer;
import com.tratif.example.repo.CustomerRepository;
import net.kaczmarzyk.spring.data.jpa.domain.DateBefore;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.domain.Between;
import net.kaczmarzyk.spring.data.jpa.domain.LessThan;
import net.kaczmarzyk.spring.data.jpa.domain.Like;
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Or;
Expand Down Expand Up @@ -60,14 +60,14 @@ public Iterable<Customer> filterCustomersByNameWithPaging(

@GetMapping(params = { "registeredBefore" })
public Iterable<Customer> findCustomersRegisteredBefore(
@Spec(path = "registrationDate", params = "registeredBefore", config = "yyyy-MM-dd", spec = DateBefore.class) NotDeletedCustomerSpecification spec) {
@Spec(path = "registrationDate", params = "registeredBefore", config = "yyyy-MM-dd", spec = LessThan.class) NotDeletedCustomerSpecification spec) {

return customerRepo.findAll(spec);
}

@GetMapping(params = { "registeredAfter", "registeredBefore" })
public Iterable<Customer> findCustomersByRegistrationDate(
@Spec(path = "registrationDate", params = {"registeredAfter", "registeredBefore"}, config = "yyyy-MM-dd", spec = DateBetween.class) NotDeletedCustomerSpecification spec) {
@Spec(path = "registrationDate", params = {"registeredAfter", "registeredBefore"}, config = "yyyy-MM-dd", spec = Between.class) NotDeletedCustomerSpecification spec) {

return customerRepo.findAll(spec);
}
Expand All @@ -81,7 +81,7 @@ public Iterable<Customer> findCustomersByGenderAndName(

@GetMapping(value = "", params = { "registeredBefore", "name" })
public Iterable<Customer> findCustomersByRegistrationDateAndName(
@Spec(path="registrationDate", params="registeredBefore", spec=DateBefore.class) NotDeletedCustomerSpecification registrationDateSpec,
@Spec(path="registrationDate", params="registeredBefore", spec= LessThan.class) NotDeletedCustomerSpecification registrationDateSpec,
@Or({@Spec(params="name", path="firstName", spec=Like.class),
@Spec(params="name", path="lastName", spec=Like.class)}) NotDeletedCustomerSpecification nameSpec) {

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/META-INF/spring-devtools.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# necessary when spring boot devtools reload feature is enabled
restart.include.specifications=/specification-arg-resolver-[\\w-]+