java 插件10.67.2.01_SpringBoot项目中分页插件PageHelper无效的问题及解决方法

在Springboot项目中使用分页插件的时候 发现PageHelper插件失效了

我导入的是:

后来才发

com.github.pagehelper

pagehelper

5.1.10

现 PageHelper若要在Springboot中使用 是需要进行注入的:

@Configuration

public class mybatisConfiguration {

@Bean

public PageHelperpageHelper(){

System.out.println("MybatisConfiguration.pageHelper()");

PageHelper pageHelper =new PageHelper();

Properties properties =new Properties();

properties.setProperty("offsetAsPageNum","true");

properties.setProperty("rowBoundsWithCount","true");

properties.setProperty("reasonable","true");

pageHelper.setProperties(properties);

return pageHelper;

}

}

当然 也可使用Springboot PageHelper启动器 无需注入 开箱即用 更推荐此方法:

com.github.pagehelper

pagehelper-spring-boot-starter

1.2.10

PS:SpringBoot项目和Spring项目依赖分页插件Pagehelper不起作用的问题

最近在SpringBoot项目和Spring项目同时开发,两个项目都依赖了Mybatis框架里的pagehelper分页插件,但是SpringBoot项目分页不起作用,一直查询出所有数据。

错误原因:两项目都引入的依赖为

com.github.pagehelper

pagehelper

4.0.0

解决办法:经过多次调查试验,发现SpringBoot项目依赖的分页插件和Spring项目有所不同,需要spring-boot-starter下的包才可以。所以SpringBoot项目需要配置下面的依赖即可:

com.github.pagehelper

pagehelper-spring-boot-starter

1.2.5

总结

到此这篇关于SpringBoot项目中分页插件PageHelper无效的问题及解决方法的文章就介绍到这了,更多相关SpringBoot分页插件PageHelper无效内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

import paramiko import pytest import psutil from common.abs_common import log @pytest.fixture(scope="module") def ssh_client(): print('-----ssh远程连接-------') ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('10.67.6.56', username='root', password='1') yield ssh ssh.close() print("获取PCIe设备的bus number,带宽和速度") def test_network_interface(ssh_client): stdin, stdout, stderr = ssh_client.exec_command("lspci|grep -i 'non' | cut -f1 -d ' '") interface = stdout.read().decode() stdin, stdout, stderr = ssh_client.exec_command(f"lspci -s {interface} -vvv |grep -i Lnkcap | cut -f2 -d ','") widthcap = stdout.read().decode().strip() outputwidthcap = stdout.read().decode("utf-8") stdin, stdout, stderr = ssh_client.exec_command(f"lspci -s {interface} -vvv |grep -i Lnksta | cut -f2 -d ','") widthsta = stdout.read().decode().strip() outputwidthsta = stdout.read().decode("utf-8") stdin, stdout, stderr = ssh_client.exec_command(f"lspci -s {interface} -vvv |grep -i Lnkcap | cut -f3 -d ','") speedcap = stdout.read().decode().strip() outputspeedcap = stdout.read().decode("utf-8") stdin, stdout, stderr = ssh_client.exec_command(f"lspci -s {interface} -vvv |grep -i Lnksta | cut -f3 -d ','") speedsta = stdout.read().decode().strip() outputspeedsta = stdout.read().decode("utf-8") print("比较lspciPCIe设备的带宽和速度Lnkcap和Lnksta") assert widthcap == widthsta assert speedcap == speedsta print(outputwidthcap,outputwidthsta,outputspeedcap,outputspeedsta) if __name__ == '__main__': pytest.main(['-o log_cli=True --html=./test_get_nic_width.html -s'])
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值