Deprecated: Constant PDO::MYSQL_ATTR_USE_BUFFERED_QUERY is deprecated since 8.5, use Pdo\Mysql::ATTR_USE_BUFFERED_QUERY instead in /www/wwwroot/www.1998123.xyz/var/Typecho/Db/Adapter/Pdo/Mysql.php on line 71
微服务eureka client第二步 - 98123_学习与记录

引入依赖

    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

写配置

#指定服务端口
server.port=8989
#指定 服务名称
spring.application.name=EUREKACLIENT
#eureka server 服务注册中心地址 暴露服务地址
eureka.client.service-url.defaultZone=http://localhost:8761/eureka

#用来修改eureka server 默认接受心跳最大时间 默认是90s
eureka.instance.lease-expiration-duration-in-seconds=10
#指定客户端多久向eureka server 发送一次心跳 默认是30s
eureka.instance.lease-renewal-interval-in-seconds=5

加注解

Application main方法上面加上这个注解
@EnableEurekaClient //让当前微服务作为一个eurekaserver客户端进行服务注册

标签: none

添加新评论