解决方法:
pagehelper:
autoRuntimeDialect: true
在yml配置文件添加如上配置即可,注意必须是驼峰型,这个坑是真的坑
后续
经过查看源码发现,PageHelper的配置类不是使用普通的Bean,而是继承Properties类。
断点发现,代码都没有进入
public void setAutoRuntimeDialect(Boolean autoRuntimeDialect) {
this.setProperty("autoRuntimeDialect", autoRuntimeDialect.toString());
}
导致这个参数配置的没有生效。
搞得我还一直纳闷是不是dynamic-datasource-spring-boot-starter的问题