遇见狂神说 SSM整合 学习笔记(完整笔记+代码)

数据库

CREATE DATABASE `ssmbuild`;

USE `ssmbuild`;

DROP TABLE IF EXISTS `books`;

CREATE TABLE `books` (
`bookID` INT(10) NOT NULL AUTO_INCREMENT COMMENT '书id',
`bookName` VARCHAR(100) NOT NULL COMMENT '书名',
`bookCounts` INT(11) NOT NULL COMMENT '数量',
`detail` VARCHAR(200) NOT NULL COMMENT '描述',
KEY `bookID` (`bookID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8

INSERT  INTO `books`(`bookID`,`bookName`,`bookCounts`,`detail`)VALUES
(1,'Java',1,'从入门到放弃'),
(2,'MySQL',10,'从删库到跑路'),
(3,'Linux',5,'从进门到进牢');

新建项目

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第1张图片

修改pom.xml文件

依赖

<dependencies>
   
   <dependency>
       <groupId>junitgroupId>
       <artifactId>junitartifactId>
       <version>4.12version>
   dependency>
   
   <dependency>
       <groupId>mysqlgroupId>
       <artifactId>mysql-connector-javaartifactId>
       <version>5.1.47version>
   dependency>
   
   <dependency>
       <groupId>com.mchangegroupId>
       <artifactId>c3p0artifactId>
       <version>0.9.5.2version>
   dependency>
 
   
   <dependency>
       <groupId>javax.servletgroupId>
       <artifactId>servlet-apiartifactId>
       <version>2.5version>
   dependency>
   <dependency>
       <groupId>javax.servlet.jspgroupId>
       <artifactId>jsp-apiartifactId>
       <version>2.2version>
   dependency>
   <dependency>
       <groupId>javax.servletgroupId>
       <artifactId>jstlartifactId>
       <version>1.2version>
   dependency>
 
   
   <dependency>
       <groupId>org.mybatisgroupId>
       <artifactId>mybatisartifactId>
       <version>3.5.2version>
   dependency>
   <dependency>
       <groupId>org.mybatisgroupId>
       <artifactId>mybatis-springartifactId>
       <version>2.0.2version>
   dependency>
 
   
   <dependency>
       <groupId>org.springframeworkgroupId>
       <artifactId>spring-webmvcartifactId>
       <version>5.1.9.RELEASEversion>
   dependency>
   <dependency>
       <groupId>org.springframeworkgroupId>
       <artifactId>spring-jdbcartifactId>
       <version>5.1.9.RELEASEversion>
   dependency>
   
   <dependency>
        <groupId>org.projectlombokgroupId>
        <artifactId>lombokartifactId>
        <version>1.18.30version>
   dependency>
dependencies>

资源过滤配置

<resources>
    <resource>
        <directory>src/main/javadirectory>
        <includes>
            <include>**/*.propertiesinclude>
            <include>**/*.xmlinclude>
        includes>
        <filtering>falsefiltering>
    resource>
    <resource>
        <directory>src/main/resourcesdirectory>
        <includes>
            <include>**/*.propertiesinclude>
            <include>**/*.xmlinclude>
        includes>
        <filtering>falsefiltering>
    resource>
resources>

整体pom.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 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0modelVersion>
    <groupId>org.damgroupId>
    <artifactId>ssm-kuang-studyartifactId>
    <packaging>warpackaging>
    <version>1.0-SNAPSHOTversion>
    <name>ssm-kuang-study Maven Webappname>
    <url>http://maven.apache.orgurl>
    <dependencies>
        
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.12version>
        dependency>
        
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <version>5.1.47version>
        dependency>
        
        <dependency>
            <groupId>com.mchangegroupId>
            <artifactId>c3p0artifactId>
            <version>0.9.5.2version>
        dependency>

        
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>servlet-apiartifactId>
            <version>2.5version>
        dependency>
        <dependency>
            <groupId>javax.servlet.jspgroupId>
            <artifactId>jsp-apiartifactId>
            <version>2.2version>
        dependency>
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>jstlartifactId>
            <version>1.2version>
        dependency>

        
        <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatisartifactId>
            <version>3.5.2version>
        dependency>
        <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatis-springartifactId>
            <version>2.0.2version>
        dependency>

        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-webmvcartifactId>
            <version>5.1.9.RELEASEversion>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-jdbcartifactId>
            <version>5.1.9.RELEASEversion>
        dependency>

        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <version>1.18.30version>
        dependency>
    dependencies>
    <build>
        <finalName>ssm-kuang-studyfinalName>
        <resources>
            <resource>
                <directory>src/main/javadirectory>
                <includes>
                    <include>**/*.propertiesinclude>
                    <include>**/*.xmlinclude>
                includes>
                <filtering>falsefiltering>
            resource>
            <resource>
                <directory>src/main/resourcesdirectory>
                <includes>
                    <include>**/*.propertiesinclude>
                    <include>**/*.xmlinclude>
                includes>
                <filtering>falsefiltering>
            resource>
        resources>
    build>
project>

完善项目文件结构

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第2张图片

整合Mybatis

增加mybatis配置文件mybatis-config.xml

这里不配置数据源,后面Spring来配置


DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

    <typeAliases>
        <package name="org.dam.pojo"/>
    typeAliases>
    <mappers>
        <mapper resource="org/dam/dao/xml/BookMapper.xml"/>
    mappers>

configuration>

pojo 实体类

实体类的字段和数据表的属性一一对应

package org.dam.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author dam
 * @create 2024/1/14 18:58
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Books {

    private int bookID;
    private String bookName;
    private int bookCounts;
    private String detail;
    
}

dao层 操作数据库

mapper接口

mapper接口负责定义一些 数据库的基本操作 接口

package org.dam.dao;

import org.dam.pojo.Books;

import java.util.List;

/**
 * @Author dam
 * @create 2024/1/14 19:01
 */
public interface BookMapper {

    /**
     * 增加一个Book
     * @param book
     * @return
     */
    int addBook(Books book);

    /**
     * 根据id删除一个Book
     * @param id
     * @return
     */
    int deleteBookById(int id);

    /**
     * 更新Book
     * @param books
     * @return
     */
    int updateBook(Books books);

    /**
     * 根据id查询,返回一个Book
     * @param id
     * @return
     */
    Books queryBookById(int id);

    /**
     * 查询全部Book,返回list集合
     * @return
     */
    List<Books> queryAllBook();

}

xml

xml文件 实现 mapper接口,为每个接口 实现 相应的sql操作


DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.dam.dao.BookMapper">

    
    <insert id="addBook" parameterType="Books">
        insert into books(bookName,bookCounts,detail)
        values (#{bookName}, #{bookCounts}, #{detail})
    insert>

    
    <delete id="deleteBookById" parameterType="int">
        delete from books where bookID=#{bookID}
    delete>

    
    <update id="updateBook" parameterType="Books">
        update books
        set bookName = #{bookName},bookCounts = #{bookCounts},detail = #{detail}
        where bookID = #{bookID}
    update>

    
    <select id="queryBookById" resultType="Books">
        select * from books
        where bookID = #{bookID}
    select>

    
    <select id="queryAllBook" resultType="Books">
        SELECT * from books
    select>

mapper>

service层 实现业务相关操作

业务接口

package org.dam.service;

import org.dam.pojo.Books;

import java.util.List;

/**
 * @Author dam
 * @create 2024/1/14 19:02
 */
public interface BookService {
    /**
     * 增加一个Book
     * @param book
     * @return
     */
    int addBook(Books book);

    /**
     * 根据id删除一个Book
     * @param id
     * @return
     */
    int deleteBookById(int id);

    /**
     * 更新Book
     * @param books
     * @return
     */
    int updateBook(Books books);

    /**
     * 根据id查询,返回一个Book
     * @param id
     * @return
     */
    Books queryBookById(int id);

    /**
     * 查询全部Book,返回list集合
     * @return
     */
    List<Books> queryAllBook();
}

业务接口实现

接口实现类负责 调用 dao层 定义的数据库操作方法,并添加一些其他逻辑

package org.dam.service.impl;

import org.dam.dao.BookMapper;
import org.dam.pojo.Books;
import org.dam.service.BookService;

import java.util.List;

/**
 * @Author dam
 * @create 2024/1/14 19:03
 */
public class BookServiceImpl implements BookService {

    //调用dao层的操作,设置一个set接口,方便Spring管理
    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public int addBook(Books book) {
        return bookMapper.addBook(book);
    }

    @Override
    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    @Override
    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    @Override
    public Books queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    @Override
    public List<Books> queryAllBook() {
        return bookMapper.queryAllBook();
    }
}

项目结构

整合Mybatis之后的项目结构如下:

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第3张图片

整合Spring

数据库连接配置 database.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssmbuild?useSSL=false&useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=12345678

数据连接配置 spring-dao.xml

整合Mybatis,配置数据库连接信息


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd">

    
    
    <context:property-placeholder location="classpath:database.properties"/>

    
    
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        
        <property name="driverClass" value="${jdbc.driver}"/>
        <property name="jdbcUrl" value="${jdbc.url}"/>
        <property name="user" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>

        
        <property name="maxPoolSize" value="30"/>
        <property name="minPoolSize" value="10"/>
        
        <property name="autoCommitOnClose" value="false"/>
        
        <property name="checkoutTimeout" value="10000"/>
        
        <property name="acquireRetryAttempts" value="2"/>
    bean>

    
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        
        <property name="dataSource" ref="dataSource"/>
        
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
    bean>

    
    
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
        
        <property name="basePackage" value="org.dam.dao"/>
    bean>

beans>

spring配置 applicationContext.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd">

    
    <context:component-scan base-package="org.dam.service" />

    
    <import resource="spring-dao.xml"/>

    
    <bean id="BookServiceImpl" class="org.dam.service.impl.BookServiceImpl">
        <property name="bookMapper" ref="bookMapper"/>
    bean>

    
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        
        <property name="dataSource" ref="dataSource" />
    bean>

beans>

项目结构

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第4张图片

整合SpringMVC

web.xml

不要直接使用下面的代码,继续往下面看

DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Applicationdisplay-name>

  
  <filter>
    <filter-name>encodingFilterfilter-name>
    <filter-class>
      org.springframework.web.filter.CharacterEncodingFilter
    filter-class>
    <init-param>
      <param-name>encodingparam-name>
      <param-value>utf-8param-value>
    init-param>
  filter>
  <filter-mapping>
    <filter-name>encodingFilterfilter-name>
    <url-pattern>/*url-pattern>
  filter-mapping>

  
  <servlet>
    <servlet-name>DispatcherServletservlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
    <init-param>
      <param-name>contextConfigLocationparam-name>
      
      <param-value>classpath:applicationContext.xmlparam-value>
    init-param>
    <load-on-startup>1load-on-startup>
  servlet>
  <servlet-mapping>
    <servlet-name>DispatcherServletservlet-name>
    <url-pattern>/url-pattern>
  servlet-mapping>

  
  <session-config>
    <session-timeout>15session-timeout>
  session-config>

web-app>

出现下面的情况,是因为idea自动添加的web.xml中的jsp页面头约束版本太低

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第5张图片

解决方法,将第一种头文件修改成第二种即可

  • 第一种头约束
DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
web-app>
  • 第二种头约束

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
web-app>

即改成下面的方式


<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

  <display-name>Archetype Created Web Applicationdisplay-name>

  
  <filter>
    <filter-name>encodingFilterfilter-name>
    <filter-class>
      org.springframework.web.filter.CharacterEncodingFilter
    filter-class>
    <init-param>
      <param-name>encodingparam-name>
      <param-value>utf-8param-value>
    init-param>
  filter>
  <filter-mapping>
    <filter-name>encodingFilterfilter-name>
    <url-pattern>/*url-pattern>
  filter-mapping>

  
  <servlet>
    <servlet-name>DispatcherServletservlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
    <init-param>
      <param-name>contextConfigLocationparam-name>
      
      <param-value>classpath:applicationContext.xmlparam-value>
    init-param>
    <load-on-startup>1load-on-startup>
  servlet>
  <servlet-mapping>
    <servlet-name>DispatcherServletservlet-name>
    <url-pattern>/url-pattern>
  servlet-mapping>

  
  <session-config>
    <session-timeout>15session-timeout>
  session-config>

web-app>

SpringMvc配置文件spring-mvc.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd
   http://www.springframework.org/schema/mvc
   https://www.springframework.org/schema/mvc/spring-mvc.xsd">

    
    
    <mvc:annotation-driven />
    
    <mvc:default-servlet-handler/>

    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    bean>

    
    <context:component-scan base-package="org.dam.controller" />

beans>

记住,还需要在applicationContext.xml中引入spring-mvc.xml配置

<import resource="spring-mvc.xml"/>

如下图所示

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第6张图片

controller控制器BookController

里面有页面跳转接口,也有真正查询数据的接口

package org.dam.controller;

import org.dam.pojo.Books;
import org.dam.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author dam
 * @create 2024/1/14 20:37
 */
@Controller
@RequestMapping("/book")
public class BookController {

    @Autowired
    @Qualifier("BookServiceImpl")
    private BookService bookService;

    @RequestMapping("/allBook")
    public String list(Model model) {
        List<Books> list = bookService.queryAllBook();
        model.addAttribute("list", list);
        return "allBook";
    }

    @RequestMapping("/toAddBook")
    public String toAddPaper() {
        return "addBook";
    }

    @RequestMapping("/addBook")
    public String addPaper(Books books) {
        System.out.println(books);
        bookService.addBook(books);
        return "redirect:/book/allBook";
    }

    @RequestMapping("/toUpdateBook")
    public String toUpdateBook(Model model, int id) {
        Books books = bookService.queryBookById(id);
        System.out.println(books);
        model.addAttribute("book",books );
        return "updateBook";
    }

    @RequestMapping("/updateBook")
    public String updateBook(Model model, Books book) {
        System.out.println(book);
        bookService.updateBook(book);
        Books books = bookService.queryBookById(book.getBookID());
        model.addAttribute("books", books);
        return "redirect:/book/allBook";
    }

    @RequestMapping("/del/{bookId}")
    public String deleteBook(@PathVariable("bookId") int id) {
        bookService.deleteBookById(id);
        return "redirect:/book/allBook";
    }
}

页面

首页index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>



    首页
    



点击进入列表页

查询所有书籍allBook.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


  书籍列表
  
  
  



书籍编号 书籍名字 书籍数量 书籍详情 操作
${book.getBookID()} ${book.getBookName()} ${book.getBookCounts()} ${book.getDetail()} 更改 | 删除

新增书籍addBook.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>



    新增书籍
    
    
    


书籍名称:


书籍数量:


书籍详情:


修改书籍

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


  修改信息
  
  
  


书籍名称: 书籍数量: 书籍详情:

项目结构

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第7张图片

配置Tomcat服务器

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第8张图片

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第9张图片

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第10张图片

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第11张图片

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第12张图片

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第13张图片

运行

首页

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第14张图片

查询所有书籍

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第15张图片

新增书籍

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第16张图片

修改书籍

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第17张图片

项目结构优化

将spring的子配置文件都放到一个文件夹中,便于寻找

遇见狂神说 SSM整合 学习笔记(完整笔记+代码)_第18张图片

新增spring-service.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd">

    
    <context:component-scan base-package="org.dam.service" />

    
    <bean id="BookServiceImpl" class="org.dam.service.impl.BookServiceImpl">
        <property name="bookMapper" ref="bookMapper"/>
    bean>

    
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        
        <property name="dataSource" ref="dataSource" />
    bean>

beans>

修改applicationContext.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd">

    
    <import resource="spring/spring-dao.xml"/>
    <import resource="spring/spring-mvc.xml"/>
    <import resource="spring/spring-service.xml"/>

beans>

文章说明

本文章为本人学习 遇见狂神说 的学习笔记,文章中大部分内容来源于狂神的视频【狂神说Java】SpringMVC最新教程IDEA版通俗易懂,也有部分内容来自于自己的思考,发布文章是想帮助其他学习的人更方便地整理自己的笔记或者直接通过文章学习相关知识,如有侵权请联系删除,最后对狂神的优质课程表示感谢。

你可能感兴趣的:(Java开发,学习,笔记,mybatis,java,spring)