SpringCloud微服务小白入门之Eureka注册中心和服务中心搭建示例
一、注册中心配置文件 代码复制区域: spring: application: name: spring-cloud-serverserver: port: 7000eureka: instance: hostname: localhost lease-expiration-duration-in-seconds: 10 #租期更新时间间隔(默认30秒) lease-renewal-interval-in-seconds: 30 #租期到期时间(默认90秒) client: registerWithEureka: false fetchRegistry: false serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ server: enable-self-preservation: false #关闭自我保护机制,保证不可用服务及时踢出 eviction-interval-timer-in-ms: 4000 #清理间隔(单位毫秒,默认是60*1000) 二、在pom.xml里添加注册中心和服务中心依赖 代码复制区域: <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring