Eureka application配置文件

发布时间 2023-09-04 16:17:46作者: 星流残阳

记录下配置文件,方便以后直接copy。

server端

server:
  port: 13000

spring:
  application:
    name: test-eureka-server

eureka:
  server:
    enable-self-preservation: true
    renewal-percent-threshold: 0.85
    eviction-interval-timer-in-ms: 60000
  client:
    register-with-eureka: false
    fetch-registry: false
  instance:
    hostname: ${spring.application.name}

client端

server:
  servlet:
    context-path: /database
  port: 13001

eureka:
  client:
    service-url:
      defaultZone: http://localhost:13000/eureka/

spring:
  application:
    name: database

client的pom.xml需要额外加入:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>