by Anonymous » 13 Feb 2025, 22:10
Ich habe eine einfache @getmapping wie folgt:
Code: Select all
@GetMapping
public Page search(Pageable pageable, List filters) {
return Page.empty();
}
< /code>
FilterCriterion.java
:
Code: Select all
public class FilterCriterion {
private @NotBlank @Size(min = 1, max = 255) String column;
private @NotNull FilterOperation operation;
private @Size(max = 255) String value;
// getters, setters, no-args and all-args constructor
}
< /code>
FilterOperation.java
:
Code: Select all
public enum FilterOperation {
EQUALS,
NOT_EQUALS,
CONTAINS,
LT,
LTE,
GT,
GTE
}
Problem
Beim Senden von GET wie diese
Code: Select all
http://localhost:8080/departments?page=0&size=10&sort=name,asc&filters[0].column=name&filters[0].operation=EQUALS&filters[1].value=foo
Ich erhalte diesen Fehler:
Code: Select all
java.lang.IllegalStateException: No primary or single unique constructor found for interface java.util.List
< /code>
Changing List
zu arrayList löst die Ausnahme auf, führt jedoch dazu, dass nur die lehbaren Datenfelder einen Wert haben. Die Liste der Filterkriterien ist immer noch leer.>
Ich habe eine einfache @getmapping wie folgt:
[code]@GetMapping
public Page search(Pageable pageable, List filters) {
return Page.empty();
}
< /code>
FilterCriterion.java[/code]:
[code]public class FilterCriterion {
private @NotBlank @Size(min = 1, max = 255) String column;
private @NotNull FilterOperation operation;
private @Size(max = 255) String value;
// getters, setters, no-args and all-args constructor
}
< /code>
FilterOperation.java[/code]:
[code]public enum FilterOperation {
EQUALS,
NOT_EQUALS,
CONTAINS,
LT,
LTE,
GT,
GTE
}
[/code]
[url=viewtopic.php?t=11587]Problem[/url]
Beim Senden von GET wie diese
[code]http://localhost:8080/departments?page=0&size=10&sort=name,asc&filters[0].column=name&filters[0].operation=EQUALS&filters[1].value=foo[/code]
Ich erhalte diesen Fehler:
[code]java.lang.IllegalStateException: No primary or single unique constructor found for interface java.util.List
< /code>
Changing List[/code] zu arrayList löst die Ausnahme auf, führt jedoch dazu, dass nur die lehbaren Datenfelder einen Wert haben. Die Liste der Filterkriterien ist immer noch leer.>