服装微商城网站建设新品牌推广策略
案发现场:
原因是这两个库用的jsqlparser版本不一致导致的
解决方案
先把jsqlparser都排除掉 然后单独引入jsqlparser依赖:
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.5</version><exclusions><exclusion><groupId>com.github.jsqlparser</groupId><artifactId>jsqlparser</artifactId></exclusion></exclusions>
</dependency>
<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>2.1.0</version><exclusions><exclusion><groupId>com.github.jsqlparser</groupId><artifactId>jsqlparser</artifactId></exclusion></exclusions>
</dependency>
<dependency><groupId>com.github.pagehelper</groupId><artifactId>sqlparser4.5</artifactId><version>6.1.0</version>
</dependency>
然后创建一个类修改方言解析器即可:
LocalMySqlDialect.java
import com.github.pagehelper.dialect.helper.MySqlDialect;
import com.github.pagehelper.parser.CountSqlParser;
import com.github.pagehelper.parser.OrderBySqlParser;
import com.github.pagehelper.parser.OrderByJSqlParser45;
import com.github.pagehelper.parser.CountJSqlParser45;
import com.github.pagehelper.util.ClassUtil;import java.util.Properties;/*** PageAutoDialect这个类是用来管理注册方言的,它在MySql的方言中默认使用了com.github.pagehelper.dialect.helper.MySqlDialect类,* 而MySqlDialect类继承自com.github.pagehelper.dialect.AbstractDialect类,而AbstractDialect默认实现了setProperties方法,不兼容的地方就在这里*/
public class LocalMySqlDialect extends MySqlDialect {@Overridepublic void setProperties(Properties properties) {this.countSqlParser = ClassUtil.newInstance(properties.getProperty("countSqlParser"), CountSqlParser.class, properties, CountJSqlParser45::new);this.orderBySqlParser = ClassUtil.newInstance(properties.getProperty("orderBySqlParser"), OrderBySqlParser.class, properties, OrderByJSqlParser45::new);}
}
ApplicationRunnerImpl.java:
import com.github.pagehelper.page.PageAutoDialect;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;@Component
public class ApplicationRunnerImpl implements CommandLineRunner {@Overridepublic void run(String... args) throws Exception {PageAutoDialect.registerDialectAlias("mysql", LocalMySqlDialect.class);}
}
重启再来一发 很好 一波未平一波又起:
去掉druid连接池filters的wall配置即可:
重启 搞定~