SpringBoot中application.yml的一些配置模板

纪录一下使用过的相关yml配置

security相关的:
security:
  oauth2:
    resource:
      prefer-token-info: true
      token-info-uri: http://sc-security-uaa/oauth/token
      jwt:
        key-value: secret
        key-uri: http://sc-security-uaa/oauth/token_key
    client:
      client-id: client
      client-secret: client
      grant-type: client_credentials
      access-token-uri: http://sc-security-uaa/oauth/token
      user-authorization-uri: http://sc-security-uaa/oauth/authorize
  sessions: stateless
  

      Security登入相关

security:
	login:
#      限制用户登录用户名或密码错误次数
		max-fail:
#      是否开启
        enabled: true
#        时长,单位为分钟
        interval: 5
#        错误次数
        times-before-lock: 5
oauth2中在Security内相关定义

     oauth2相关

 oauth2:
      browser:
        client-id: webapp
        client-secret: webapp
        grant-type: password
        scope: all

      验证码相关

 validate-code:
      image:
        expire-in: 180
        height: 40
        width: 200
        count: 4
Redis相关:
  redis:
    host: 127.0.0.1
    password: 123456
    database: 9
spring默认相关:
spring:
  datasource:
    name: dataSource
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
    username: root
    password: root
    druid:
      initialSize: 1
      minIdle: 1
      maxActive: 20
      maxWait: 60000
      validationQuery: select 'x' from dual
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      filters: stat,slf4j
      web-stat-filter:
        exclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.woff2,*.ico,/druid/*,/swagger*,/v2/api-docs'
      stat-view-servlet:
        enabled: true
        login-username: admin
        login-password: 123456
      filter:
        stat:
          enabled: true
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: true
        slf4j:
          enabled: true
          statement-executable-sql-log-enable: false
          connection-log-enabled: false
          result-set-log-enabled: false
mybatis相关
mybatis:
  mapper-locations: classpath:mybatis/mapper/**/*Mapper.xml
  config-location: classpath:mybatis/mybatis-config.xml
Spring Cloud 相关
sc:
  cloud:
    debug: true
    task:
      core-pool-size: 20
      max-pool-size: 50
      queue-capacity: 200
      keep-alive-seconds: 3000
      thread-name-prefix: sc-task-executor-
    swagger:
      enabled: true
      description: 'spring cloud module Template project '
Spring Cloud Task 相关
 task:
      core-pool-size: 20
      max-pool-size: 50
      queue-capacity: 200
      keep-alive-seconds: 3000
      thread-name-prefix: sc-task-executor-
rocketmq 相关
rocketmq:
      logging: true
      tag: tag
      topic: log
      producer-group: default
      name-server-address: 127.0.0.1:8080
eureka服务注册相关
eureka:
  client:
    #是否注册自己
    registerWithEureka: false
    #获取客户端信息
    fetchRegistry: false
  server:
    enable-self-preservation: false
Spring Cloud Ribbon 相关
ribbon:
  ConnectTimeout: 60000
  ReadTimeout: 60000
  MaxAutoRetries: 0
  MaxAutoRetriesNextServer: 1
断路器Hystrix相关
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeout-in-milliseconds: 20000
ZUUL-API网关 相关
zuul:
  routes:
    uaa:
      path: /uaa/**
      serviceId: sc-security-uaa
    web:
      path: /web/**
      serviceId: sc-web
      sensitiveHeaders:
    webauth:
      path: /webauth/**
      serviceId: sc-web-auth
      sensitiveHeaders:
    job:
      path: /job/**
      serviceId: sc-job
      sensitiveHeaders:
    project:
      path: /project/**
      serviceId: sc-project
      sensitiveHeaders:
    pcclient:
      path: /pcclient/**
      serviceId: sc-example-pcclient
      sensitiveHeaders:
    appclient:
      path: /appclient/**
      serviceId: sc-example-appclient
      sensitiveHeaders:
  add-proxy-headers: true
  add-host-header: true
  retryable: false
  • 3
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
application.yml,可以配置一些与web应用相关的属性和设置。其一些常见的配置项包括: 1. 服务器端口:可以通过设置"server.port"属性来指定应用程序的监听端口号。 2. 上下文路径:可以通过设置"server.servlet.context-path"属性来指定应用程序的上下文路径。 3. 静态资源路径:可以通过设置"spring.resources.static-locations"属性来指定静态资源文件的路径。 4. 错误页面:可以通过设置"server.error.whitelabel.enabled"属性来启用或禁用默认的错误页面,或者通过设置"server.error.path"属性来指定自定义错误页面的路径。 5. 页面模板:可以通过设置"spring.thymeleaf.prefix"属性来指定Thymeleaf模板引擎的模板文件路径。 6. 数据源配置:可以通过设置"spring.datasource"属性来配置数据库连接信息,包括数据库URL、用户名、密码等。 7. 日志配置:可以通过设置"logging.level"属性来配置日志级别,或者通过设置"logging.file"属性来指定日志文件的路径。 总之,在application.yml配置web作用是为了定制和调整web应用程序的行为和设置,以满足特定的需求和要求。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [SpringBoot--application.yml配置文件--用法](https://blog.csdn.net/feiying0canglang/article/details/120406824)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [SpringBootapplication.yml配置文件的详情及多环境切换](https://blog.csdn.net/qq_41512902/article/details/125931390)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值