GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — springboot-learn/spring-boot-mybatis-xml at master · eumji025/springboot-learn

Expand file tree

/

spring-boot-mybatis-xml

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

spring-boot-mybatis-xml

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
sql
sql
 
 
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

mybatisXml

是通过mapper的xml格式方式进行数据操作的demo

关键部分

1.引入依赖

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

2.配置文件

#数据库连接配置
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/jdbc
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
#mynatis配置
mybatis:
  type-aliases-package: com.eumji.mybatisxml.vo
  #mapper加载路径
  mapper-locations: classpath:com/eumji/mybatisxml/mapper/*Mapper.xml
  #myatbis配置文件
  config-location: classpath:mybatis-conf.xml

3.在实体类添加别名注解@alisa("table-name")

4.在mapper添加@mapper注解

测试方法在test包下 可以写个controller

5.添加了自己基于pagehelper写的分页工具类,可以注释掉相关的代码或者回退版本 其实就是减少了一些中间代码.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.