From 82051aa9290e5a2dd4c8a0b1bdd03be2eab42bf5 Mon Sep 17 00:00:00 2001 From: Nils Israel Date: Fri, 19 May 2023 17:07:41 +0200 Subject: [PATCH] add spring boot devtools and classloader workaround --- pom.xml | 6 +++++- .../com/tratif/example/web/CustomerController.java | 10 +++++----- src/main/resources/META-INF/spring-devtools.properties | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/META-INF/spring-devtools.properties diff --git a/pom.xml b/pom.xml index 2193c6b..5188530 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,11 @@ net.kaczmarzyk specification-arg-resolver - 3.0.0-SNAPSHOT + 3.0.1 + + + org.springframework.boot + spring-boot-devtools io.github.classgraph diff --git a/src/main/java/com/tratif/example/web/CustomerController.java b/src/main/java/com/tratif/example/web/CustomerController.java index f6b1777..23fa277 100644 --- a/src/main/java/com/tratif/example/web/CustomerController.java +++ b/src/main/java/com/tratif/example/web/CustomerController.java @@ -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; @@ -60,14 +60,14 @@ public Iterable filterCustomersByNameWithPaging( @GetMapping(params = { "registeredBefore" }) public Iterable 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 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); } @@ -81,7 +81,7 @@ public Iterable findCustomersByGenderAndName( @GetMapping(value = "", params = { "registeredBefore", "name" }) public Iterable 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) { diff --git a/src/main/resources/META-INF/spring-devtools.properties b/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000..09f6f1d --- /dev/null +++ b/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1,2 @@ +# necessary when spring boot devtools reload feature is enabled +restart.include.specifications=/specification-arg-resolver-[\\w-]+