SpringCloud项目搭建(六) —elastic-job的使用,以及consul的配置使用(衔接上篇)

所需材料

compile "com.dangdang:elastic-job-lite-core:2.1.5"
compile "com.dangdang:elastic-job-lite-spring:2.1.5"
compile 'org.springframework.cloud:spring-cloud-starter-consul-discovery
compile 'org.springframework.cloud:spring-cloud-starter-consul-config:2.1.1.RELEASE'
compile 'org.springframework.cloud:spring-cloud-starter-consul-discovery:2.1.1.RELEASE'

启用sirius-quartz项目,总体结构如下

在这里插入图片描述
配置文件信息

  • application.yml:
server:
  port: 8011
spring:
  profiles:
    active: dev
  application:
    name: quartz-server
  security:
   user:
     name: admin
     password: 12345
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.0.21.66:3306/sirius?useUnicode=true&characterEncoding=UTF-8
    username: 9now_dev
    password: 9now.321
  mail:
    host: ${mail.config.host}
    port: ${mail.config.port}
    username: ${mail.config.username}
    password: ${mail.config.password}
    properties:
      mail.smtp.auth: true

mybatis:
  type-aliases-package:
    com.cloud.sirius.demo.service.entity
  mapper-locations:
    classpath:mybatis/*.xml

mapper:
  mappers:
    tk.mybatis.mapper.common.Mapper
  notEmpty:
    true

  • bootstrap.yml:
spring:
  cloud:
    consul:
      discovery:
        hostname: localhost
        port: 8500
        tags: version=1.0,author=hmdbb
        instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
        enabled: true
        service-name: ${spring.application.name}
      config:
        # 快速失败
        fail-fast: true
        #启用
        enabled: true
        #consul上面文件的格式  YAML FILES PROPERTIES KEY-VALUE
        format: YAML
        # 基本文件夹
        prefix: config
        # 所有应用程序默认文件夹名
        defaultContext: application
        #设置分隔符的值,用于使用配置文件在属性源中分隔配置文件名称
        profileSeparator: ','
        data-key: data
        watch:
          #调用的频率 1000 毫秒
          delay: 1000
logging:
  config:
    classpath:logback-test.xml
  • logback-test.xml

                
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值