标签:nbsp 信息 line 文件 size gis 中介 font product

pom中导入一个依赖
   <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            </dependency>
    </dependencies>
创建一个启动类
@SpringBootApplication @EnableEurekaServer public class AppStart { public static void main(String[] args) { SpringApplication.run(AppStart.class, args); } }
创建配置文件
#内置的tomcat服务启动监听端口号 server: port: 6001 #应用名称 #spring: # application: # name: EurekaServer01 #EurekaServer配置 eureka: instance: hostname: eureka6001.com client: register-with-eureka: false #此EurekaServer不在注册到其他的注册中心 fetch-registry: false #不在从其他中心中心拉取服务器信息 service-url: defaultZone: http://eureka6002.com:6002/eureka #注册中心访问地址
6002与6001相似 配置文件 稍作修改即可
在03_provider中的修改(类似于中介的存在)
pom中再添加下面的依赖
 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
主启动类中添加下面代码 主要是@EnableEurekaClinet注解
@MapperScan("com.offcn.springcloud.mapper")
@SpringBootApplication
@EnableEurekaClient             
public class ProductProvider_8001 {
    public static void main(String[] args) {
        SpringApplication.run(ProductProvider_8001.class,args);
    }
}
配置文件中添加下面代码
#EurekaServer配置 eureka: client: register-with-eureka: true #此EurekaServer不在注册到其他的注册中心 fetch-registry: true #不在从其他中心中心拉取服务器信息 service-url: defaultZone: http://eureka6001.com:6001/eureka,http://eureka6002.com:6002/eureka #注册中心访问地址
标签:nbsp 信息 line 文件 size gis 中介 font product
原文地址:https://www.cnblogs.com/proyuan/p/11824388.html