Como podemos trocar o tamanho padrão das páginas
- Criar novo pacote chamado "configurer"
- Criar nova classe "DevDojoWebMvcConfigurer"
- Inserir anotação @Configuration e implementar WebMvcConfigurer na classe
- Sobrescrever o método "addArgumentResolvers"
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
@Configuration
public class DevDojoWebMvcConfigurer implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
PageableHandlerMethodArgumentResolver pageHandler = new PageableHandlerMethodArgumentResolver();
pageHandler.setFallbackPageable(PageRequest.of(0,10));
resolvers.add(pageHandler);
}
}
Video no Youtube: https://youtu.be/1_Bp3JFZ4Cs