关于Eureka启动器和配置
Eureka启动器
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
}
application.yml配置
server:
port: 10086 # 端口
spring:
application:
name: supergo-eureka # 应用名称,会在Eureka中显示
eureka:
client:
register-with-eureka: false # 是否注册自己的信息到EurekaServer,默认是true
fetch-registry: false # 是否拉取其它服务的信息,默认是true
service-url: # EurekaServer的地址,现在是自己的地址,如果是集群,需要加上其它Server的 地址。
defaultZone: http://127.0.0.1:10086/eureka
server:
enable-self-preservation: false #关闭自我保护
eviction-interval-timer-in-ms: 10000 #剔除失效微服务的轮询间隔时间