1.添加依赖
<!-- mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
2.配置通过application.properties 或application.yml方式
#端口号
server.port=9003
# 数据库连接相关配置
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
spring.datasource.driverClassName=oracle.jdbc.driver.OracleDriver
spring.datasource.username=c##scott
spring.datasource.password=accp
# MyBatis注解形式扫描实体类路径
mybatis.type-aliases-package=com.csesteel.model
# MyBatis XML形式配置文件路径
mybatis.config-locations=classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations=classpath:mapping/*.xml
server:
port: 9003
spring:
datasource:
url: jdbc:oracle:thin:@localhost:1521:orcl
driver-class-name: oracle.jdbc.driver.OracleDriver
data-username: c##scott
password: accp
mybatis:
type-aliases-package: com.csesteel.model
config-location: classpath:mybatis/mybatis-config.xml
mapper-locations: classpath:mapping/*.xml