Spring Cloud 入门 Consul-Client服务提供
程序员文章站
2022-07-24 14:36:57
前面介绍了 Rureka Client服务提供, 只需要改pom.xml部分内容 1、pom.xml 2、application配置 主要改动就这2块,其他如参照上一篇Eureka-Client ......
前面介绍了 Rureka Client服务提供, 只需要改pom.xml部分内容
1、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.example</groupId> <artifactId>consulClient</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>consulClient</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-consul-dependencies</artifactId> <version>1.0.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
2、application配置
spring.application.name=consulClient server.port=1001 spring.cloud.consul.host=127.0.0.1 spring.cloud.consul.port=8500
主要改动就这2块,其他如参照上一篇Eureka-Client
推荐阅读
-
[Spring cloud 一步步实现广告系统] 11. 使用Feign实现微服务调用
-
微服务架构下使用Spring Cloud Zuul作为网关将多个微服务整合到一个Swagger服务上
-
Spring Cloud Alibaba | Nacos服务中心初探
-
spring cloud 入门系列八:使用spring cloud sleuth整合zipkin进行服务链路追踪
-
Spring Cloud下使用Feign Form实现微服务之间的文件上传
-
spring cloud服务提供与调用示例
-
漫谈微服务架构:什么是Spring Cloud,为何要选择Spring Cloud
-
Spring Cloud(十):服务网关 Zuul(路由)【Finchley 版】
-
Spring Cloud第五篇 | 服务熔断Hystrix
-
spring cloud eureka服务搭建(生产者消费者)