application.properties--不推荐使用,代码臃肿
#数据库访问的url地址
spring.datasource.url=jdbc:mysql://localhost:3306/web
#全连接
spring.datasource.url=jdbc:mysql://localhost:3306/web
?Unicode=true&characterEncoding=utf-8&useSSL=false&
serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
#数据库驱动类类名
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#访问数据库-用户名
spring.datasource.username=root
#访问数据库-密码
spring.datasource.password=1234
#mybatis的日志输出配置
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#切换druid连接池
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#mybatis的mapper.xml文件路径
mybatis.type-aliases-package=com.itheima.pojo
application.yml--推荐使用规范:
spring:
datasource:
#数据库访问的url地址
url: jdbc:mysql://localhost:3306/web?Unicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
#数据库驱动类类名
driver-class-name: com.mysql.cj.jdbc.Driver
#访问数据库-用户名
username: root
#访问数据库-密码
password: root
#切换druid连接池
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
configuration:
#开启驼峰命名自动映射
map-underscore-to-camel-case: true
#mybatis的日志输出配置
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#mybatis的mapper.xml文件路径
type-aliases-package: com.itheima.pojo
Mybatis日志输出配置
mybatis:
configuration:
#mybatis的日志输出配置
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
分页
分页合理化参数:实现page<0为1 page>max为max
pagehelper:
reasonable: true
helper-dialect: mysql
spring事务管理日志
#spring事务管理日志
logging:
level:
org.springframework.jdbc.support.JdbcTransactionManager: debug
SpringBoot文件上传大小设置
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB