搭建SpringCloud项目

转载文章

主要分为以下几步:

(1)搭建SpringBootService,这里是各个微服务的业务逻辑。(这里搭建了2个Service,用来测试熔断)

(2)搭建SpringBootEureka,用来发现服务。

(3)搭建SpringBootConfig,用于动态维护配置文件。

(4)搭建SpringBootConsumer,这个不是必须的,只有当一个更大的业务需要调用其他多个微服务Service时才需要搭建。

     可以通过Ribbon+RestTemplate,Feign两种方式进行微服务之间的调用。可以加入Hystrix进行熔断处理。

(5)搭建SpringBootZuul,用于路由控制。可以加入Hystrix用于熔断处理。

(6)使用Jenkins进行代码的自动化部署。

修改

读取本地config配置文件:
Git:git;
SVN:svn;
本地:native;

springbootconfig下配置文件application.yml

server:
  port: 6002
spring:
  application:
    name: springbootConfig
  profiles:
    active: native
  cloud:
    config:
      server:
        native:
          searchLocations: I:/study/SpringCloud-master/config
#    active: subversion
#  cloud:
#    config:
#      server:
#        svn:
#          uri: http://172.16.11.15/svn/concom/PRIVATE_CLOUD/PRIVATE_BACK_RESOLVER/GitHubProSC
##          uri: git@github.com:kongfanjun10/spring-cloud-config.git
#          username: kongfanjun
#          password: Kongfanjun@1115
#          default-label:

eureka:
  client:
    service-url:
      defaultZone: http://localhost:5000/eureka/
  instance:
    preferIpAddress: true
    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
    lease-expiration-duration-in-seconds: 30
    lease-renewal-interval-in-seconds: 30

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值