在application.properties文件中配置数据源:
数据源配置
此处是mySql的数据源
spring.datasource.url=jdbc:mysql://localhost:3306/springbootdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&&zeroDateTimeBehavior=CONVERT_TO_NULL&&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
此处是SqlServer的数据源
spring.datasource.url=jdbc:sqlserver://localhost:1433;DatabaseName=数据库名
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.username=用户名
spring.datasource.password=密码
在application.properties下添加以下配置
Mybatis 配置
映射xml文件
mybatis.mapperLocations=classpat