配置模板
1.build.gradle
plugins {
id 'org.springframework.boot' version '2.5.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.zufe'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
2.application.yml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
password: password
url: jdbc:mysql://localhost:3306/数据库名称
username: username
jpa:
show-sql: true
mybatis:
mapper-locations: classpath:mapper/*Mapper.xml
type-aliases-package: com.herbert.demo.entity
configuration:
map-underscore-to-camel-case: true
cache-enabled: false