1. 程式人生 > >springboot-mybatis配置(xml)/springboot-jpa配置

springboot-mybatis配置(xml)/springboot-jpa配置

enc ren ati mysql har char date sources lec

#springboot-mybatis配置(xml)
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
mybatis.mapper-locations=classpath*:mybatis/*Mapper.xml
mybatis.type-aliases-package=com.forezp.entity

  通過配置mybatis.mapper-locations來指明mapper的xml文件存放位置,我是放在resources/mybatis文件下的。mybatis.type-aliases-package來指明和數據庫映射的實體的所在包。

springboot-jpa配置

spring.datasource.url=jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql= true

  

springboot-mybatis配置(xml)/springboot-jpa配置