这些文件名前缀都是application后缀可以是properties或yml或yaml
# 修改端口号
server.port=8081
#配置文件的真实位置
#spring.messages.basename=i18n.login 页面用#{}取
#关闭模板引擎
#spring.thymeleaf.cache=false
#时间日期格式化
#spring.mvc.format.date-time=yyyy-MM-dd
#激活指定配置文件
#spring.profiles.active=dev
数据库连接和druid数据源配置
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
username: root
password: root
type: com.alibaba.druid.pool.DruidDataSource
#SpringBoot默认是不注入这些属性值,需要自己绑定
#druid 数据源专有配置
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolpreparedStatements: true
#配置监控统计拦截的filters,stat:监控统计、log4j:日志记录、wall:防御sql注入
#如果允许是报错 java.lang.ClassNotFoundException: org.apache.log4j.Priority
#则导入log4j依赖即可,Maven地址:https://mvnrepository.com/artifact/log4j/log4j
filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
mybatis配置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=root
#整合mybatis
mybatis.type-aliases-package=com.wang.pojo
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
邮件配置
spring.mail.username=1472583690@qq.com
spring.mail.password=qweadfavxasd
spring.mail.host=smtp.qq.com
#开启加密验证
spring.mail.properties.mail.smtp.ssl.enable=true
redis
# SpringBoot所有的配置类都有一个自动配置类
# 自动配置类都会绑定properties配置文件
spring.redis.host=127.0.0.1
spring.redis.port=6379
dubbo+zookeeper
server.port=8001
#服务应用名字
dubbo.application.name=provider-server
#注册中心地址
dubbo.registry.address=zookeeper://127.0.0.1:2181
#扫描包
dubbo.scan.base-packages=com.wang.service
server.port=8002
#消费者去哪里拿服务需要暴露自己的名字
dubbo.application.name=consumer-server
#注册中心的地址 可以在任何电脑上
dubbo.registry.address=zookeeper://127.0.0.1:2181