SpringBoot配置文件

 这些文件名前缀都是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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AqrJan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值