spring cloud-将spring boot服务注册到Eureka Server上
来源:互联网 发布:通过网络被骗的案例 编辑:程序博客网 时间:2024/06/07 01:39
开篇:
我们将前面的
springboot整合H2内存数据库,实现单元测试与数据库无关性
提供的Restful服务注册到spring cloud的Eureka Server上。一、引入Eureka的Client
</dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency></dependencies><dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Camden.SR3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies></dependencyManagement>二、添加配置文件
# spring boot服务注册到Eureka Server上的应用名称spring.application.name=springboot-h2eureka.instance.prefer-ip-address=true# Eureka Server注册服务的地址eureka.client.service-url.defaultZone=http://localhost:8761/eureka三、开启Eureka Client支持
package com.chhliu.springboot.h2;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.eureka.EnableEurekaClient;@SpringBootApplication@EnableEurekaClientpublic class SpringbootH2Application {public static void main(String[] args) {SpringApplication.run(SpringbootH2Application.class, args);}}四、启动spring boot服务并验证
通过上面几个步骤,说明我们已经将spring boot的服务注册到了Eureka Server上了!
五、可能出现的问题
如果在服务注册的过程中,发现Connection refused异常,如下:
有可能是hosts文件中没有加入如下映射关系
127.0.0.1 loaclhost
0 0
- spring cloud-将spring boot服务注册到Eureka Server上
- 学习Spring Cloud第六课(将微服务注册到Eureka Server上)
- 学习Spring Cloud第六课(将微服务注册到Eureka Server上)
- Spring cloud eureka+Client+Spring boot admin 服务注册监控
- Spring Cloud Eureka-服务注册
- [Spring Cloud-01] eureka server 服务注册与发现
- 【Spring Cloud】一、Eureka Server 服务注册中心服务端启动
- Spring Cloud (19) | Eureka Server 高可用服务注册中心
- Spring Cloud 基于eureka 服务注册中心
- spring cloud 实现Eureka注册服务
- Spring Cloud Eureka-服务注册、消费、断路
- Spring-Cloud 服务注册与发现 Eureka
- Spring Cloud Eureka服务注册与发现
- 【Spring Cloud】Eureka服务注册中心搭建
- Spring Cloud Eureka 服务注册与发现
- 非Spring Boot Web项目 注册节点到Eureka Server并提供服务
- 非Spring Boot Web项目 注册节点到Eureka Server并提供服务
- Spring Cloud 注册中心Eureka
- java 等待所有线程执行完毕
- BestCoder Round #91
- 使用JavaMailSenderImpl实现Email发送
- 前后端对请求参数排序
- vs为QT程序添加icon图标
- spring cloud-将spring boot服务注册到Eureka Server上
- 自定义第三方包
- 微信红包的坑~参数详解和密钥的坑
- vcf通讯录格式解析
- 自适应屏幕的后台系统?
- 2016年的总结
- Ajax+SpingMVC总结
- WEB标准的概念及组成
- DDos/DoS工具集(持续更新)