在使用mybatis-plus-boot-starter
时,不需要额外添加spring-boot-starter-jdbc
依赖。因为mybatis-plus-boot-starter
已经包含了对JDBC的依赖。
mybatis-plus-boot-starter
会自动配置数据源和JdbcTemplate,用于支持数据库访问操作。所以只需添加以下两个依赖即可:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
这样就可以使用MyBatis-Plus进行MySQL数据库操作了。如果你同时还需要其他数据库相关功能,如连接池、事务管理等,可以根据需要添加相应的依赖。
内容由零声教学AI助手提供,问题来源于学员提问