所需材料
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