forked from spring-projects/spring-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Spring Data Web configuration properties
This commit adds support for configuring Spring Data Web `PageableHandlerMethodArgumentResolver` and `SortHandlerMethodArgumentResolver` using configuration properties. See spring-projectsgh-9339
- Loading branch information
Showing
4 changed files
with
187 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
...rc/main/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright 2012-2017 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.boot.autoconfigure.data.web; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
/** | ||
* Configuration properties for Spring Data Web. | ||
* | ||
* @author Vedran Pavic | ||
* @since 2.0.0 | ||
*/ | ||
@ConfigurationProperties("spring.data.web") | ||
public class SpringDataWebProperties { | ||
|
||
private final Pageable pageable = new Pageable(); | ||
|
||
private final Sort sort = new Sort(); | ||
|
||
public Pageable getPageable() { | ||
return this.pageable; | ||
} | ||
|
||
public Sort getSort() { | ||
return this.sort; | ||
} | ||
|
||
/** | ||
* Pageable properties. | ||
*/ | ||
public static class Pageable { | ||
|
||
/** | ||
* Page index parameter name. | ||
*/ | ||
private String pageParameter = "page"; | ||
|
||
/** | ||
* Page size parameter name. | ||
*/ | ||
private String sizeParameter = "size"; | ||
|
||
/** | ||
* Default page size. | ||
*/ | ||
private int defaultPageSize = 20; | ||
|
||
public String getPageParameter() { | ||
return this.pageParameter; | ||
} | ||
|
||
public void setPageParameter(String pageParameter) { | ||
this.pageParameter = pageParameter; | ||
} | ||
|
||
public String getSizeParameter() { | ||
return this.sizeParameter; | ||
} | ||
|
||
public void setSizeParameter(String sizeParameter) { | ||
this.sizeParameter = sizeParameter; | ||
} | ||
|
||
public int getDefaultPageSize() { | ||
return this.defaultPageSize; | ||
} | ||
|
||
public void setDefaultPageSize(int defaultPageSize) { | ||
this.defaultPageSize = defaultPageSize; | ||
} | ||
} | ||
|
||
/** | ||
* Sort properties. | ||
*/ | ||
public static class Sort { | ||
|
||
/** | ||
* Sort parameter name. | ||
*/ | ||
private String sortParameter = "sort"; | ||
|
||
public String getSortParameter() { | ||
return this.sortParameter; | ||
} | ||
|
||
public void setSortParameter(String sortParameter) { | ||
this.sortParameter = sortParameter; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters