1、安装consul
2、consul agent -dev启动
3、
server: port: 9001 spring: servlet: multipart: max-file-size: 100MB max-request-size: 100MB profiles: active: dev application: name: enc-provider redis: database: 0 host: 10.xx.xx port: 6379 timeout: 5000 datasource: url: jdbc:mysql://10.xx.xx:3306/enc-oss-view?useUnicode=yes&characterEncoding=UTF-8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: consul: host: 10.xx.xx port: 8500 discovery: prefer-ip-address: true health-check-critical-timeout: 30s kafka: bootstrap-servers: 10.xx.xx:9092 producer: retries: 0 batch-size: 16384 buffer-memory: 33554432 key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer management: endpoints: web: exposure: include: "*" mybatis: mapper-locations: - classpath*:/mapper/*-mapper.xml config-location: classpath:mybatis-config.xml #mapper mapper: mappers: com.encdata.oss.starter.web.base.EncMapper not-empty: false identity: MYSQL #pagehelper pagehelper: helperDialect: mysql reasonable: true supportMethodsArguments: true params: count=countSql pageSizeZero: true rowBoundsWithCount: true offsetAsPageNum: true #日志 logging: config: classpath:logback-${spring.profiles.active}.xml info: security: enabled: false jwtSecret: encdata2019 defaultExpiredDate: 1800 whiteUrlList: - /user/login fdfs: enabled: true # 读取时间 soTimeout: 5000 # 连接超时时间 connectTimeout: 5000 # 缩略图 thumbImage: width: 150 height: 150 # tracker列表 trackerList: 10.xx.xx:22122 return-url: http://10.xx.xx:9999/
4、注解
@SpringBootApplication @EnableDiscoveryClient @EnableTransactionManagement @MapperScan(value = "com.xx.oss.bakend.mapper",annotationClass = Repository.class) @EnableFeignClients(basePackages = {"com.xx.oss.user.api"})