标签:depend 继承 instance ann 获取 config cat aging public
案例创建的工程名为:springcloue_parent_02
修改pom文件
<packaging>pom</packaging>
<!--Springcloud的依赖库文件版本的锁定-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
案例子工程名为:eureka
<parent>
<groupId>com.yl</groupId>
<artifactId>springcloue_parent_02</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!--配置eureka依赖库组件-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
spring:
application:
name: eureka
server:
port: 7001
#eureka的基本信息
eureka:
instance:
hostname: eureka.com
client:
service-url:
defaultZone: http://127.0.0.1:7001/eureka/
#本身就是注册中心,不需要注册
register-with-eureka: false
#本身就是注册中心,不需要获取注册信息
fetch-registry: false
package com.yl.eureka;
import org.springframework.boot.Banner;
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);
SpringApplication springApplication=new SpringApplication(EurekaApplication.class);
springApplication.setBannerMode(Banner.Mode.OFF);
springApplication.run(args);
}
}
浏览器访问eureka服务:http://localhost:7001
标签:depend 继承 instance ann 获取 config cat aging public
原文地址:https://www.cnblogs.com/Y-wee/p/14129138.html