SpringCloud子项目

Spring Cloud简介

Spring Cloud是一个基于Spring Boot实现的云应用开发工具,它为基于JVM的云应用开发中涉及的配置管理、服务发现、断路器、智能路由、微代理、控制总线、全局锁、决策竞选、分布式会话和集群状态管理等操作提供了一种简单的开发方式。

Spring Cloud包含了多个子项目(针对分布式系统中涉及的多个不同开源产品),比如:Spring Cloud Config、Spring Cloud Netflix、Spring Cloud CloudFoundry、Spring Cloud AWS、Spring Cloud Security、Spring Cloud Commons、Spring Cloud Zookeeper、Spring Cloud CLI等项目。

微服务架构是将一个完整的应用从数据存储开始垂直拆分成多个不同的服务,每个服务都能独立部署、独立维护、独立扩展,服务与服务间通过诸如RESTful API的方式互相调用。

 

主要子项目

Spring Cloud Config

由git仓库支持的集中式外部配置管理。 配置资源直接映射到Spring Environment,也可用于非Spring应用程序。

Spring Cloud Netflix

由各种Netflix OSS组件(Eureka,Hystrix,Zuul,Archaius等)集成。

Spring Cloud Bus

用于将服务和服务实例以及分布式消息传递链接的事件总线。 用于在集群中传播状态更改(例如,配置更改事件)。

Spring Cloud Cluster

Zookeeper,Redis,Hazelcast,Consul的抽象和实施的领导选举和共同的状态模式。

Spring Cloud Consul

Zookeeper,Redis,Hazelcast,Consul的抽象和实施的领导选举和共同的状态模式。

Spring Cloud Security

在Zuul代理中支持负载均衡的OAuth2休眠客户端和认证头中继。

Spring Cloud Task

一种短期的微服务框架,用于快速构建执行有限数据处理的应用程序。 简单的声明,将功能和非功能功能添加到Spring Boot应用程序。

Spring Cloud Zookeeper

使用Apache Zookeeper进行服务发现和配置管理。

 

开发环境:

MacOS Sierra

IDE IntelliJ IDEA 2016.2.5

JRE: 1.8.0_112-release-287-b2 x86_64

JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Apache Maven 3.3.9

Google Chrome 59.0.3071

 

我的工程结构:

 

父工程pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.luangeng</groupId>
    <artifactId>cloud</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>com.xxx.App</start-class>
    </properties>
    
    <modules>
        <module>rest</module>
        <module>jpa</module>
        <module>config</module>
        <module>eureka</module>
        <module>consumer</module>
        <module>client1</module>
        <module>client2</module>
        <module>web</module>
        <module>zuul</module>
        <module>rabbit</module>
        <module>kafka</module>
        <module>zookeeper</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- TEST -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>

</project>

---

 

子工程pom.xml示例:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>cloud</artifactId>
        <groupId>com.luangeng</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>zuul</artifactId>
    <packaging>jar</packaging>
    <name>zuul</name>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zuul</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
    </dependencies>
</project>

---

 

 

GitHub:

https://github.com/luangeng/Cloud.git 

 

参考

http://projects.spring.io/spring-cloud/spring-cloud.html

http://cloud.spring.io/spring-cloud-netflix/

 

end

posted @ 2017-07-14 23:02  dahuandahuan  阅读(304)  评论(0编辑  收藏  举报