[springboot]mybatis与springboot整合的配置文件(properties)

首先给出Maven项目的pom.xml配置文件中需要添加的依赖:

<dependencies>
	
	<dependency>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-starter-webartifactId>
	dependency>
	
	<dependency>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-starter-thymeleafartifactId>
	dependency>
	
	<dependency>
		<groupId>org.mybatis.spring.bootgroupId>
		<artifactId>mybatis-spring-boot-starterartifactId>
		<version>1.1.1version>
	dependency>
	
	<dependency>
		<groupId>mysqlgroupId>
		<artifactId>mysql-connector-javaartifactId>
	dependency>
	
	<dependency>
		<groupId>com.alibabagroupId>
		<artifactId>druidartifactId>
		<version>1.0.9version>
	dependency>
dependencies>

mybatis与springboot整合的配置文件(application.properties):

spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/ssm
spring.datasource.username=root
spring.datasource.password=root

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

mybatis.type-aliases-package=com.csdn.pojo

在service层的实现类上加注解
@Transactional

最后要在java启动类上加注解
@MapperScan(“mapper层所在路径”)

你可能感兴趣的:(配置文件,配置文件整理)