阅读背景:

SpringBoot整合Mybatis 以及 mybatis自动生成代码配置

来源:互联网 

1、springboot的配置文件application.yml

#端口
server:
  port: 8080

  #模板页面
  #注释的部分是Thymeleaf默认的配置,如有其它需求可以自行更改
  spring:
    thymeleaf:
      cache: false
      prefix: classpath:/templates/
      suffix: .html
      mode: LEGACYHTML5
#      encoding: UTF-8
#      content-type: text/html

##数据源一
#spring:
#      datasource:
#          driverClass: com.mysql.jdbc.Driver
#          url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8
#          username: xuan
#          password: 123456
#数据源二
spring:
      datasource:
          url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8
          username: xuan
          password: 123456
          # 使用druid数据源
          type: com.alibaba.druid.pool.DruidDataSource
          driver-class-name: com.mysql.cj.jdbc.Driver
          filters: stat
          maxActive: 20
          initialSize: 1
          maxWait: 60000
          minIdle: 1
          timeBetweenEvictionRunsMillis: 60000
          minEvictableIdleTimeMillis: 300000
          validationQuery: select 'x'
          testWhileIdle: true
          testOnBorrow: false
          testOnReturn: false
          poolPreparedStatements: true
          maxOpenPreparedStatements: 20

#spring-boot整合mybatis
mybatis:
  #config-location: classpath:/mapper/config/mybatisConfig.xml #可以注射掉,没用到该配置文件
  mapper-locations: classpath:/mapper/*Mapper.xml
  #type-aliases-package: com.xuan.entity

#端口
serve



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: