• 史上最简单的 SpringCloud 教程



    http://blog.csdn.net/forezp/article/details/69696915  (旧版本)

    https://www.fangzhipeng.com/springcloud/2018/08/01/sc-f1-eureka.html (新版本)

    史上最简单的 SpringCloud 教程 | 终章

     第一篇: 服务的注册与发现(Eureka)

    第二篇: 服务消费者(rest+ribbon)

    第三篇: 服务消费者(Feign)

    第四篇:断路器(Hystrix)

    第五篇: 路由网关(zuul)

    第六篇: 分布式配置中心(Spring Cloud Config)

    第七篇: 高可用的分布式配置中心(Spring Cloud Config)

     第八篇: 消息总线(Spring Cloud Bus)

     第九篇: 服务链路追踪(Spring Cloud Sleuth)

     第十篇: 高可用的服务注册中心

     第十一篇:docker部署spring cloud项目

    第十三篇: 断路器聚合监控(Hystrix Turbine)

    第十四篇: 服务注册(consul)

    spring boot和spring cloud 开发必备工具准备 和 必备网站导航

    spring boot和spring cloud 开发必备工具准备 和 必备网站导航

    本文主要介绍spring cloud开发前期准备,为以后学习和开发有一些资料保障: 
    常用网站:

    1. spring boot 官网英文网站,有一些简单和详细的介绍 http://projects.spring.io/spring-boot/

    2. spring cloud 官方英文网站 http://projects.spring.io/spring-cloud/

    3. spring cloud 中国社区 http://bbs.springcloud.cn/

    4. spring cloud 中文网 有翻译不全中文文档 https://springcloud.cc/

    5. spring boot maven gradle 配置 一键生产并下载 http://start.spring.io/

    6. Netflix网飞公司github 包含 eureka和zuul 等相关工程, 
      并且有相关文档和各类问题解决 https://github.com/Netflix/eureka

    7. 51CTO有目前最新的spring cloud微服务实战课程的主要就是讲springcloud基本组件讲解。

    8. 2017年5月份刚出的一本spring cloud的书可以某东 某宝有卖。

    9. spring cloud 英文文档 http://cloud.spring.io/spring-cloud-static/Camden.SR3/

    这里写图片描述

    spring cloud 是基于spring boot微服务架构设计开发的。主要还是针对spring boot开调整开发工具。

    1. 首先spring cloud项目是依赖JDK1.8,这个需要自行安装即可。

    2、然后可以下载新版的eclipse进行安装,本人安装的最新 eclispe neon2 需要jdk8启动,也可以用其他版本,感觉新版的对spring boot支持比较好 
    http://www.eclipse.org/downloads/eclipse-packages/

    3、安装相应项目构建插件maven或者gradle,建议安装较新版本的。

    4、在 eclipse 安装相应插件,主要要安装spring suit tool 和 maven 插件, 如果用gradle开发则安装gradle插件,如果有失败安装过程可能需要多安装那么一两次就能成功了。 
    下面的具体插件截图:

    这里写图片描述

    这里写图片描述 
    这里写图片描述

    这里写图片描述

    这里写图片描述

    这里写图片描述

    本人使用的是maven工具进行项目构建: 
    相关的setting.xml如下:建议使用第三方maven库,比如阿里的库速度就挺快的,不然拉去jar包和一些xml约束在没有网络代理将是一个纠结过程。

    <?xml version="1.0" encoding="UTF-8"?>
    
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
      <localRepository>D:/maven-repository</localRepository>
    
    
      <pluginGroups>
        <pluginGroup>org.mortbay.jetty</pluginGroup>
      </pluginGroups>
    
    
      <proxies>
    
      </proxies>
    
      <servers>
    
        <server>
            <id>releases</id>
            <username>ali</username>
            <password>ali</password>
          </server>
          <server>
            <id>Snapshots</id>
            <username>ali</username>
            <password>ali</password>
          </server>
      </servers>
    
    
      <mirrors>
    
        <mirror>
          <!--This sends everything else to /public -->
          <id>nexus</id>
          <mirrorOf>*</mirrorOf> 
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </mirror>
        <mirror>
          <!--This is used to direct the public snapshots repo in the 
              profile below over to a different nexus group -->
          <id>nexus-public-snapshots</id>
          <mirrorOf>public-snapshots</mirrorOf> 
          <url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
        </mirror>
      </mirrors>
    
    
      <profiles> 
        <profile>
          <id>development</id>
          <repositories>
            <repository>
              <id>central</id>
              <url>http://central</url>
              <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </repository>
          </repositories>
         <pluginRepositories>
            <pluginRepository>
              <id>central</id>
              <url>http://central</url>
              <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
        <profile>
          <!--this profile will allow snapshots to be searched when activated-->
          <id>public-snapshots</id>
          <repositories>
            <repository>
              <id>public-snapshots</id>
              <url>http://public-snapshots</url>
              <releases><enabled>false</enabled></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </repository>
          </repositories>
         <pluginRepositories>
            <pluginRepository>
              <id>public-snapshots</id>
              <url>http://public-snapshots</url>
              <releases><enabled>false</enabled></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
    
       <activeProfiles>
        <activeProfile>development</activeProfile>
        <activeProfile>public-snapshots</activeProfile>
       </activeProfiles>
    </settings>

    由于选择新版本的eclipse是自带maven插件和marketPlace很方便。选择新版本原因主要也是用来进行spring cloud 项目开发。

    上述工作做好后,就可以看到导入外部maven工程后可以让项目在run as 有spring boot App启动不必去到切换main主类中进行启动。而且添加的spring boot支持可以使用application.yml作为主要配置文件取代application.properties 使用配置具体结构化的提示,填写非常简单。

    对于spring boot项目的依赖可以查看pom文件中的选项,避免一些导入一些不必要的jar包,或者有冲突的jar包。 
    如下图: 
    这里写图片描述

    作者:罗阿红 出处:http://www.cnblogs.com/luoahong/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
  • 相关阅读:
    python基础学习24----使用pymysql连接mysql
    HTML基本标签
    python基础学习20----线程
    MySQL基础操作
    python永久添加第三方模块,PYTHONPATH的设置
    MySQL压缩包zip安装
    汇编语言debug命令与指令机器码
    python基础学习23----IO模型(简)
    python基础学习22----协程
    python基础学习21----进程
  • 原文地址:https://www.cnblogs.com/kelelipeng/p/12849762.html
Copyright © 2020-2023  润新知