SpringBoot 集成 Mybatis

这篇具有很好参考价值的文章主要介绍了SpringBoot 集成 Mybatis。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

SpringBoot 集成 Mybatis 详细教程

(只有操作,没有理论,仅供参考学习)

一、操作部分

1. 准备数据库

1.1 数据库版本:

C:\WINDOWS\system32>mysql -V
mysql  Ver 8.0.25 for Win64 on x86_64 (MySQL Community Server - GPL)

1.2 启动 mysql 服务:

C:\WINDOWS\system32>net start mysql
The MySQL service is starting..
The MySQL service was started successfully.

1.3 新创建数据库 spring,并创建一个 user 表,user 表详情:

Column Name 		Datatype		PrimaryKey 		Unique
id     				  INT				√			  √
username			  VARCHAR(45)	
password			  VARCHAR(45)	

如下图:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

2. 创建工程

2.1 使用 spring 官网页面创建工程(其他亦可),链接:Spring Initializr 创建 SpringBoot 工程,如下图:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

2.2 用 IDEA 打开工程:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

2.3 配置项目的 maven 环境:
File -> Setting... -> Maven

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端
2.4 导入依赖 pom.xml 文件:

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
            <version>8.0.25</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

注意点:由于我的项目运行有报错的原因,我把项目的版本调整了一下:
修正前:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.13</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

修正后:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

配置完成后完整的 pom.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<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>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.buzl</groupId>
    <artifactId>main</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>main</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
            <version>8.0.25</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

2.5 配置数据库连接文件 application.properties

注意点
第一行的数据库要修改为自己的数据库名称,我的数据库名称是 spring,根据实际需求更改
第二行和第三行是连接数据库的用户名和密码,根据实际需求更改
第四行是数据库的驱动,使用 com.mysql.cj.jdbc.Driver 还是 com.mysql.jdbc.Driver 按需更改
第五行是 mybatis mapper 文件路径,我的文件路径是:resources/mapper/UserMapper.xml,按需更改

spring.datasource.url=jdbc:mysql://localhost:3306/spring?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.mapper-locations=classpath:mapper/*.xml

2.6 创建 User.java 实体类

public class User {

    /**
     * 主键 id
     */
    private Integer id;

    private String username;

    private String password;
    
    public User(Integer id, String username, String password) {
        this.id = id;
        this.username = username;
        this.password = password;
    }

    /**
     * 重写 toString 方法
     * @return
     */
    @Override
    public String toString() {
        return "User{" +
                "id = " + id +
                "\t username = " + username +
                "\t password = " + password +
                "}";
    }
    // set and get method ...
}

2.7 创建 UserMapper 接口

@Mapper // 表示这是一个 Mybatis 的 mapper 类
@Repository
public interface UserMapper {

    @Autowired
    int insertUser(User user);
    
    @Autowired
    int deleteByPrimaryKey(Integer id);
    
    @Autowired
    User selectByPrimaryKey(Integer id);
    
    @Autowired
    int updateUserByPrimaryKey(User user);
    
    @Autowired
    List<User> selectAll();
    
}

2.8 创建 UserMapper 控制器

@RestController
@RequestMapping("/mybatis")
public class UserConroller {

    @Resource
    private UserMapper userMapper;

    @GetMapping("/selectAll")
    public List<User> selectAll() {
        List<User> userList = userMapper.selectAll();
        return userList;
    }

    @GetMapping("/selectByPrimaryKey")
    public User selectByPrimaryKey() {
        User user = userMapper.selectByPrimaryKey(111);
        return user;
    }

    @GetMapping("/insertSelective")
    public String insertUser() {
        User user = new User(123, "梅花", "pwd123");
        userMapper.insertUser(user);
        return "insert data to database success!";
    }

    @GetMapping("/updateByPrimaryKeySelective")
    public String updateUserByPrimaryKey() {
        Integer id = 123;
        User user = new User(id, "刘备", "pwd666");
        userMapper.updateUserByPrimaryKey(user);
        return "database updated success!";
    }

    @GetMapping("/deleteByPrimaryKey")
    public String deleteByPrimaryKey() {
        Integer id = 123;
        userMapper.deleteByPrimaryKey(id);
        return "delete database success!";
    }

}

2.6 UserMapper.xml 文件

注意点id 的值要和 UserMapper 接口的函数名称对应上
如:

 xml 文件 id 的值 selectAll 名字和 UserMapper 接口中的函数名一一对应
xml 文件:
<select id="selectAll" resultType="com.buzl.main.entity.User">

UserMapper 接口函数:
@Autowired
List<User> selectAll();
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.buzl.main.mapper.UserMapper">

    <!--共通属性抽出-->
    <sql id="Base_Column_List">
        id,username,password
    </sql>

    <!--查询数据库中所有的数据-->
    <select id="selectAll" resultType="com.buzl.main.entity.User">
        <!--select * from spring.user-->
        select <include refid="Base_Column_List" /> from spring.user
    </select>

    <!--通过 id 查询数据-->
    <select id="selectByPrimaryKey" resultType="com.buzl.main.entity.User">
        select <include refid="Base_Column_List" /> from spring.user where id=#{id}
    </select>

    <!--向数据库中插入数据-->
    <insert id="insertUser" parameterType="com.buzl.main.entity.User">
        insert into spring.user(<include refid="Base_Column_List" />) values(#{id},#{username},#{password})
    </insert>

    <!--更新数据库中的数据-->
    <update id="updateUserByPrimaryKey" parameterType="com.buzl.main.entity.User">
        update spring.user set username=#{username},password=#{password} where id=#{id}
    </update>

    <!--通过 id 删除数据-->
    <delete id="deleteByPrimaryKey" parameterType="Integer">
        delete from spring.user where id=#{id}
    </delete>

</mapper>

二、代码部分

1. 项目目录结构:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

2. User 实体类

package com.buzl.main.entity;

/**
 * 实体类
 *
 * @author buzenglai@gmail.com
 * @data 2023-07-10
 */
public class User {

    /**
     * 主键 id
     */
    private Integer id;

    private String username;

    private String password;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public User(Integer id, String username, String password) {
        this.id = id;
        this.username = username;
        this.password = password;
    }

    /**
     * 重写 toString 方法
     * @return
     */
    @Override
    public String toString() {
        return "User{" +
                "id = " + id +
                "\t username = " + username +
                "\t password = " + password +
                "}";
    }

}

3. UserController 控制器类

package com.buzl.main.controller;

import com.buzl.main.mapper.UserMapper;
import com.buzl.main.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * controller 实现
 *
 * @author buzenglai@gmail.com
 * @data 2023-07-10
 */
@RestController
@RequestMapping("/mybatis")
public class UserConroller {

    @Resource
    private UserMapper userMapper;

    /**
     * 查询数据操作
     *
     * @return
     */
    @GetMapping("/selectAll")
    public List<User> selectAll() {
        List<User> userList = userMapper.selectAll();
        System.out.println("数据库中所有的 user 数据 :" + userList);
        return userList;
    }

    /**
     * 通过 id 查询操作
     *
     * @return
     */
    @GetMapping("/selectByPrimaryKey")
    public User selectByPrimaryKey() {
        User user = userMapper.selectByPrimaryKey(111);
        System.out.println("通过 id 查询出来的 user : " + user);
        return user;
    }

    /**
     * 插入数据
     *
     * @return
     */
    @GetMapping("/insertSelective")
    public String insertUser() {
        User user = new User(123, "梅花", "pwd123");
        userMapper.insertUser(user);
        System.out.println("user :" + user + " 被成功插入数据库");
        return "insert data to database success!";
    }

    /**
     * 更新数据
     *
     * @return
     */
    @GetMapping("/updateByPrimaryKeySelective")
    public String updateUserByPrimaryKey() {
        Integer id = 123;
        User user = new User(id, "刘备", "pwd666");
        userMapper.updateUserByPrimaryKey(user);
        System.out.println("数据库中 id = " + id + " 的数据已经被更新了");
        return "database updated success!";
    }

    /**
     * 删除数据
     *
     * @return
     */
    @GetMapping("/deleteByPrimaryKey")
    public String deleteByPrimaryKey() {
        Integer id = 123;
        userMapper.deleteByPrimaryKey(id);
        System.out.println("数据库中 id = " + id + " 的 user 数据已经被删除了");
        return "delete database success!";
    }

}

4. UserMapper 接口

package com.buzl.main.mapper;

import com.buzl.main.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 接口类
 *
 * @author buzenglai@gmail.com
 * @data 2023-07-10
 */
@Mapper // 表示这是一个 Mybatis 的 mapper 类
@Repository
public interface UserMapper {

    /**
     * 向数据库中插入一条数据
     *
     * @param user
     * @return
     */
    @Autowired
    int insertUser(User user);

    /**
     * 通过主键 id 删除数据
     *
     * @param id
     * @return
     */
    @Autowired
    int deleteByPrimaryKey(Integer id);

    /**
     * 通过主键 id 删除数据库中的数据
     *
     * @param id
     * @return
     */
    @Autowired
    User selectByPrimaryKey(Integer id);

    /**
     * 通过主键 id 更新数据库中的数据
     *
     * @param user
     * @return
     */
    @Autowired
    int updateUserByPrimaryKey(User user);

    /**
     * 查询数据库中所有的数据
     *
     * @return
     */
    @Autowired
    List<User> selectAll();

}

5. UserMapper.xml 文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.buzl.main.mapper.UserMapper">

    <!--共通属性抽出-->
    <sql id="Base_Column_List">
        id,username,password
    </sql>

    <!--查询数据库中所有的数据-->
    <select id="selectAll" resultType="com.buzl.main.entity.User">
        <!--select * from spring.user-->
        select <include refid="Base_Column_List" /> from spring.user
    </select>

    <!--通过 id 查询数据-->
    <select id="selectByPrimaryKey" resultType="com.buzl.main.entity.User">
        select <include refid="Base_Column_List" /> from spring.user where id=#{id}
    </select>

    <!--向数据库中插入数据-->
    <insert id="insertUser" parameterType="com.buzl.main.entity.User">
        insert into spring.user(<include refid="Base_Column_List" />) values(#{id},#{username},#{password})
    </insert>

    <!--更新数据库中的数据-->
    <update id="updateUserByPrimaryKey" parameterType="com.buzl.main.entity.User">
        update spring.user set username=#{username},password=#{password} where id=#{id}
    </update>

    <!--通过 id 删除数据-->
    <delete id="deleteByPrimaryKey" parameterType="Integer">
        delete from spring.user where id=#{id}
    </delete>

</mapper>

6. 数据库连接配置文件:

spring.datasource.url=jdbc:mysql://localhost:3306/spring?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.mapper-locations=classpath:mapper/*.xml

7. pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<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>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.buzl</groupId>
    <artifactId>main</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>main</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!--springboot 集成 mybatis,导入依赖-->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>
        <!--mysql 驱动-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
            <version>8.0.25</version>
        </dependency>
        <!--jdbc连接数据库-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

三、测试

使用 ApiFox 工具进行测试(用浏览器也是一样)

  1. 查询数据库中所有的数据:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

  1. 通过 id 查询数据库中的数据:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

  1. 向数据库中插入数据:

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

  1. 通过 id 更改数据库中的数据

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端

  1. 通过 id 删除数据库的数据
    SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端
    SpringBoot 集成 Mybatis,Spring,spring boot,mybatis,后端
  2. 控制台打印信息:
数据库中所有的 user 数据 :[User{id = 111	 username = 张三	 password = pwd111}, User{id = 222	 username = 李四	 password = pwd222}]
数据库中所有的 user 数据 :[User{id = 111	 username = 张三	 password = pwd111}, User{id = 222	 username = 李四	 password = pwd222}]
通过 id 查询出来的 user : User{id = 111	 username = 张三	 password = pwd111}
user :User{id = 123	 username = 梅花	 password = pwd123} 被成功插入数据库
数据库中所有的 user 数据 :[User{id = 111	 username = 张三	 password = pwd111}, User{id = 123	 username = 梅花	 password = pwd123}, User{id = 222	 username = 李四	 password = pwd222}]
数据库中 id = 123 的数据已经被更新了
数据库中所有的 user 数据 :[User{id = 111	 username = 张三	 password = pwd111}, User{id = 123	 username = 刘备	 password = pwd666}, User{id = 222	 username = 李四	 password = pwd222}]
数据库中 id = 123 的 user 数据已经被删除了
数据库中所有的 user 数据 :[User{id = 111	 username = 张三	 password = pwd111}, User{id = 222	 username = 李四	 password = pwd222}]

这是结束标志,结束了 ~文章来源地址https://www.toymoban.com/news/detail-579799.html

到了这里,关于SpringBoot 集成 Mybatis的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • spring-boot集成mybatis真的很简单吗?

    在日常的后端开发中,使用mybatis作为DAO层的持久框架已经是惯例。但很多时候都是在别人搭好的框架中进行开发,对怎么搭建环境是一知半解,今天就来实践下。 来看下集成mybatis需要哪些步骤, 1、确定环境及依赖 2、配置文件; 3、测试 这里, 基于springboot集成mybatis。 先

    2024年02月08日
    浏览(35)
  • spring boot集成mybatis-plus——Mybatis Plus 查询数据(图文讲解)

     更新时间 2023-01-03 16:07:12 大家好,我是小哈。 本小节中,我们将学习如何通过 Mybatis Plus 查询数据库表中的数据。 在前面小节中,我们已经定义好了一个用于测试的用户表, 执行脚本如下: 定义一个名为  User  实体类: 不明白 Mybatis Plus 实体类注解的小伙伴,可参考前面

    2024年02月02日
    浏览(48)
  • 从零开始学Spring Boot系列-集成MyBatis-Plus

    在Spring Boot应用开发中,MyBatis-Plus是一个强大且易于使用的MyBatis增强工具,它提供了很多实用的功能,如代码生成器、条件构造器、分页插件等,极大地简化了MyBatis的使用和配置。本篇文章将指导大家如何在Spring Boot项目中集成MyBatis-Plus。 首先,确保你已经安装了Java开发环

    2024年04月08日
    浏览(66)
  • spring boot集成mybatis-plus——Mybatis Plus 批量 Insert_新增数据(图文讲解)

     更新时间 2023-01-10 16:02:58 大家好,我是小哈。 本小节中,我们将学习如何通过 Mybatis Plus 实现 MySQL 批量插入数据。 先抛出一个问题:假设老板给你下了个任务,向数据库中添加 100 万条数据,并且不能耗时太久! 通常来说,我们向 MySQL 中新增一条记录,SQL 语句类似如下:

    2024年02月04日
    浏览(35)
  • Spring Boot集成MyBatis Plus中的QueryWrapper的eq方法详解及示例代码

    1. 简介 MyBatis Plus是一个强大的MyBatis增强工具包,它为我们在进行数据库操作时提供了很多便利的方法。其中,QueryWrapper是MyBatis Plus中的一个重要类,它可以用于构建复杂的查询条件。 在QueryWrapper中,eq方法是最常用的一个,它用于构建等值条件查询。在本文中,我们将详细

    2024年02月10日
    浏览(28)
  • spring boot集成mybatis-plus——Mybatis Plus 新增数据并返回主键 ID(图文讲解)

     更新时间 2023-01-10 15:37:37 大家好,我是小哈。 本小节中,我们将学习如何通过 Mybatis Plus 框架给数据库表新增数据,主要内容思维导图如下: Mybatis Plus 新增数据思维导图 为了演示新增数据,在前面小节中,我们已经定义好了一个用于测试的用户表, 执行脚本如下: 定义一

    2024年02月02日
    浏览(41)
  • spring boot集成mybatis-plus——Mybatis Plus 多表联查(包含分页关联查询,图文讲解)...

     更新时间 2023-01-03 21:41:38 大家好,我是小哈。 本小节中,我们将学习如何通过 Mybatis Plus 实现 多表关联查询 ,以及 分页关联查询 。 本文以 查询用户所下订单 ,来演示 Mybatis Plus 的关联查询,数据库表除了前面小节中已经定义好的用户表外,再额外创建一张订单表,然后

    2024年02月01日
    浏览(72)
  • 【SpringBoot】Spring Boot 项目中整合 MyBatis 和 PageHelper

    目录 前言         步骤 1: 添加依赖 步骤 2: 配置数据源和 MyBatis 步骤 3: 配置 PageHelper 步骤 4: 使用 PageHelper 进行分页查询 IDEA指定端口启动 总结         Spring Boot 与 MyBatis 的整合是 Java 开发中常见的需求,特别是在使用分页插件如 PageHelper 时。PageHelper 是一个针对 MyBat

    2024年04月25日
    浏览(32)
  • spring boot集成Elasticsearch-SpringBoot(25)

      搜索引擎(search engine )通常意义上是指:根据特定策略,运用特定的爬虫程序从互联网上搜集信息,然后对信息进行处理后,为用户提供检索服务,将检索到的相关信息展示给用户的系统。   而我们讲解的是捜索的索引和检索,不涉及爬虫程序的内容爬取。大部分公司

    2023年04月09日
    浏览(94)
  • Spring Boot学习随笔- 集成JSP模板(配置视图解析器)、整合Mybatis(@MapperScan注解的使用)

    学习视频:【编程不良人】2021年SpringBoot最新最全教程 在main创建webapp,然后创建index.jsp进行测试,在访问之前需要进行一个设置,否则springboot是找不到jsp页面的 修改jsp无需重启应用 数据库访问框架:hibernate、jpa、mybatis【主流】 SpringBoot(微框架) = Spring(工厂) + SpringMV

    2024年02月05日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包