mybatis-plus ,maven, thymeleaf和springboot的运用和技术分析 你怎么看 ?请介绍一下这几个功能和用法
时间: 2023-03-24 14:02:36 浏览: 81
这几个功能都是用于Java Web开发的技术,其中Mybatis-Plus是一个基于Mybatis的增强工具,可以简化Mybatis的使用,提高开发效率;Maven是一个项目管理工具,可以自动化构建、依赖管理和发布;Thymeleaf是一个模板引擎,可以将数据和模板结合生成HTML页面;Spring Boot是一个快速开发框架,可以简化Spring应用的搭建和开发。这些技术的运用可以使Java Web开发更加高效、简便和灵活。
相关问题
mybatis-plus 的maven最新版本 springboot
mybatis-plus 的最新版本是 3.4.3,可以通过以下 Maven 依赖添加到 Spring Boot 项目中:
```xml
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3</version>
</dependency>
```
同时,需要在 application.properties 或 application.yml 中配置相关的数据库连接信息和 Mybatis Plus 的配置,例如:
```yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/db_example
username: user
password: pass
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
```
mybatis-plus分页插件配置springboot
好的,下面是 Mybatis-Plus 分页插件配置 Spring Boot 的步骤:
1. 首先,需要在 pom.xml 中添加 Mybatis-Plus 的依赖:
```
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.x.x</version>
</dependency>
```
2. 然后,在 Spring Boot 的配置文件中,添加 Mybatis-Plus 的配置:
```
# Mybatis-Plus 配置
mybatis-plus:
# mapper 映射文件位置
mapper-locations: classpath*:mapper/*.xml
# 自动填充配置
global-config:
db-config:
# 数据库字段自动填充
field-strategy: not_empty
# 数据库插入操作,自动填充字段
insert-strategy: not_null
# 数据库更新操作,自动填充字段
update-strategy: not_null
```
3. 接下来,在代码中使用 Mybatis-Plus 提供的 Page 类来进行分页查询:
```
// 创建分页对象
Page<User> page = new Page<>(pageNum, pageSize);
// 查询数据
List<User> userList = userMapper.selectPage(page, null);
// 获取分页信息
PageInfo<User> pageInfo = new PageInfo<>(userList);
```
其中,pageNum 表示当前页码,pageSize 表示每页显示的数据条数,userMapper 是 Mybatis-Plus 自动生成的 Mapper 类。
以上就是 Mybatis-Plus 分页插件配置 Spring Boot 的简单步骤,希望能对你有所帮助。