@Configuration
public class JdbcTemplateConfig {
@Bean
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
}
在Controller中调用定义的分页查询方法:
@RequestMapping("/page")
public List getPageData(@RequestParam int pageNum, @RequestParam int pageSize) {
return service.findAllByPage(pageNum, pageSize);
}