Reputation: 2942
In a Spring MVC controller I want to use default Pageable
values from a properties file.
@RequestMapping
public String list(Model model, @PageableDefault(size = 5, sort = "title") Pageable pageable) {
// ...
}
I tryied to simply write size = properties.getSize()
but it needs a constant.
How to make size
and sort
parameter configurable via properties file?
Upvotes: 1
Views: 1237
Reputation: 4932
# DATA REST (RepositoryRestProperties)
spring.data.rest.base-path= # Base path to be used by Spring Data REST to expose repository resources.
spring.data.rest.default-page-size= # Default size of pages.
spring.data.rest.detection-strategy=default # Strategy to use to determine which repositories get exposed.
spring.data.rest.enable-enum-translation= # Enable enum value translation via the Spring Data REST default resource bundle.
spring.data.rest.limit-param-name= # Name of the URL query string parameter that indicates how many results to return at once.
spring.data.rest.max-page-size= # Maximum size of pages.
spring.data.rest.page-param-name= # Name of the URL query string parameter that indicates what page to return.
spring.data.rest.return-body-on-create= # Return a response body after creating an entity.
spring.data.rest.return-body-on-update= # Return a response body after updating an entity.
spring.data.rest.sort-param-name= # Name of the URL query string parameter that indicates what direction to sort results.
or look for properties here
Upvotes: 1