本文最后更新于:2021年9月29日 凌晨
概览:SpringBoot配置文件,三个文件写法
properties文件
1 2 3 4 5 6 7
| spring.datasource.url=jdbc:mysql://localhost:3306/springjob?useSSL=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.username=root spring.datasource.password=1234 spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.qfc.mybatisjob.entity
|
另一种
https://www.cnblogs.com/charlypage/p/11220755.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| logging.level.org.springframework=DEBUG
mybatis.mapper-locations = classpath:mapper/*Mapper.xml
spring.datasource.driver-class-name= com.mysql.jdbc.Driver spring.datasource.url = jdbc:mysql://localhost:3306/dss_wshop?useUnicode=true&characterEncoding=utf-8 spring.datasource.username = root spring.datasource.password = root
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.cache=false
pagehelper.helperDialect=mysql pagehelper.reasonable=true pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql
|
yml文件
- 来源:朝权的dubbo作业(h2 + lombok的日志)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| spring: application: name: qunar-address-provider datasource: url: jdbc:h2:mem:user_db;MODE=MySQL driver-class-name: org.h2.Driver username: root password: root jpa: show-sql: true h2: console: enabled: true path: /h2 thymeleaf: prefix: classpath:/templates/ check-template-location: true cache: false suffix: .html mode: HTML5 logging: config: classpath:logback-config.xml server: port: 81
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| server: port: 8080
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/mybatis_homework?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC username: root password: 123456 application: name: mybatis-homework
mybatis: mapper-locations: classpath:mapper/*Mapper.xml type-aliases-package: com.jiam.qunar.homework0805.bean configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
pagehelper: helper-dialect: mysql
|
xml文件
yaml文件