SpringBoot 2.1.5 集成MyBatis

1 gradle

plugins {
   
    id 'org.springframework.boot' version '2.1.5.RELEASE'
    id 'groovy'
    id 'org.asciidoctor.convert' version '1.5.3'
}

apply plugin: 'io.spring.dependency-management'

group = 'com.wxx.modules'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
   
    all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-web'
    compile.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-jetty'
    developmentOnly
    runtimeClasspath {
   
        extendsFrom developmentOnly
    }
    compileOnly {
   
        extendsFrom annotationProcessor
    }
}

repositories {
   
    maven {
   
        url 'http://maven.aliyun.com/nexus/content/groups/public/'
    }
    mavenCentral()
}
repositories {
   
    mavenCentral()
}

dependencies {
   
    //非传递依赖
    //implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    //implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
    //implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
    //implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive'

    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    implementation 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.boot:spring-boot-starter-reactor-netty'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-aop'

    //JMS
    implementation "javax.jms:javax.jms-api:2.0"
    implementation "org.springframework:spring-messaging"
    implementation "org.springframework:spring-jms"
    implementation "com.sun.messaging.mq:imq:4.6-b01"
    implementation "com.sun.messaging.mq:jms:4.6-b01"

    implementation 'com.google.guava:guava:27.0.1-jre'
    implementation 'org.apache.commons:commons-lang3:3.8.1'
    implementation 'org.apache.commons:commons-text:1.6'
    implementation 'org.apache.cxf:cxf-rt-transports-http-hc:3.2.0'
    implementation 'org.apache.cxf:cxf-rt-frontend-jaxws:3.2.0'
    implementation 'com.sun.xml.bind:jaxb-core:2.2.11'
    implementation 'com.sun.xml.bind:jaxb-impl:2.2.11'

    implementation 'commons-lang:commons-lang:2.6'
    implementation 'commons-collections:commons-collections:3.2.2'
    implementation 'org.apache.commons:commons-collections4:4.3'
    implementation 'joda-time:joda-time:2.10.1'
    implementation 'com.graphql-java:java-dataloader:2.2.1'
    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.0.1'
    implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'
    implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.1.0.jre7'
    implementation group: 'capital.scalable', name: 'spring-auto-restdocs-json-doclet', version: '2.0.4'


    //测试时编译
    testCompile group: 'capital.scalable', name: 'spring-auto-restdocs-core', version: '2.0.4'


    //编译时依赖
    compileOnly 'org.projectlombok:lombok'

    //注解处理器
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'

    //测试时依赖
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation "org.spockframework:spock-core:1.2-groovy-2.4"
    testImplementation 'org.mockito:mockito-core:2.24.5'
    testImplementation 'io.projectreactor:reactor-test:3.2.6.RELEASE'
}

2 application-dev.yml

management:
  endpoints.web:
    base-path: /management
    exposure.include: '*'
  server.port: 9090

server:
  connection-timeout: 30000ms
  port: 8081
  servlet.context-path: /

logging:
  path: ./
  file: st.log
  #max-size: 10M
  #max-history: 1
  level:
    com:
      wxx:
        modules:
          mapper: debug
spring:
  data:
    mongodb:
      database: studentService
      host: localhost
      port: 27017
  datasource:
    url: jdbc:mysql://localhost:3306/studentService?useSSL=false&useUnicode=true&characterEncoding=UTF-8
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 12345678
    # schema.sql中一般存放的是DDL脚本,即通常为创建或更新库表的脚本
    # data.sql中一般是DML脚本,即通常为数据插入脚本
    schema: classpath:schema.sql
    data: classpath:data.sql
    platform: mysql
    initialization-mode: always
    continue-on-error: false
    #data-password:
    #data-username:
    #schema-password:
    #schema-username:
    sql-script-encoding: utf-8
    separator: ;



mybatis:
  typeAliasesPackage: com.com.wxx.modules.st.domain
  mapper-locations: classpath:mapper\/*.xml*/

master:
  name: EvanDevyml
  sex: nv
  subject: chi

3 初始化脚本

schema.sql

CREATE DATABASE IF NOT EXISTS `studentService`;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值