# Resolving Sort and Pageable Arguments

By using an argument resolvers pagination data can be generated from a request:

```java
@GetMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public final Iterable<ModelObject>
            getObjects(final Pageable page) {
    return getBusinessService().getObjects(page);
}
```

## XML Configuration

First define the resolvers:

```markup
<bean id="sortResolver" class="resolver.sort.class=org.springframework.data.web.SortHandlerMethodArgumentResolver" />
<bean id="pagingResolver" class="resolver.pageable.class=org.springframework.data.web.PageableHandlerMethodArgumentResolver">
   <constructor-arg ref="sortResolver" />
</bean>
```

Then register them:

```markup
<mvc:annotation-driven>
   <mvc:argument-resolvers>
      <ref bean="sortResolver" />
      <ref bean="pagingResolver" />
   </mvc:argument-resolvers>
</mvc:annotation-driven>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bernardo.gitbook.io/development-docs-java/spring-mvc/loading-pageable-automatically.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
