MyBatisPlus插件IPage引入错误
我在配置mp的IPage配置的时候,发现MybatisPlusInterceptor一直显示找不到这个类,我其他代码块都正常使用Mp的LambdaQuery功能,但就是分页功能一直不生效。 MybatisConfig `package xlin.com.config;
import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;
@Configuration public class MybatisConfig {
▼text复制代码@Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { // 1.初始化核心插件 MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); // 2.添加分页插件 PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor(DbType.MYSQL); pageInterceptor.setMaxLimit(1000L); // 设置分页上限 interceptor.addInnerInterceptor(pageInterceptor); return interceptor; }
}` service/pom.xml 以下是service层的pom.xml
▼<?xml复制代码<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>XLin.com</groupId> <artifactId>main</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>service</artifactId> <version>0.0.1-SNAPSHOT</version> <name>service</name> <description>service</description> <properties> <java.version>17</java.version> <mybatis-plus.version>3.5.10.1</mybatis-plus.version> </properties> <dependencies> <!-- 内部模块依赖 --> <dependency> <groupId>XLin.com</groupId> <artifactId>model</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>XLin.com</groupId> <artifactId>common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--连接池依赖--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!-- 修改 MyBatis-Plus 依赖,排除冲突的 mybatis-spring --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- 显式添加兼容的 mybatis-spring 版本 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>3.0.3</version> </dependency> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <scope>runtime</scope> </dependency> <!--websocket--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-extension</artifactId> <version>${mybatis-plus.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>17</source> <target>17</target> <compilerArgs>--enable-preview</compilerArgs> </configuration> </plugin> </plugins> </build> </project>
有没有机智聪明的鱼友帮我解决这个问题?
评论
问答助学
相关内容
0个评论
全部评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
