Eureka-Server的搭建

1.pom.xml

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    4.0.0

 

    net.xdclass

    eureka_server

    0.0.1-SNAPSHOT

    jar

 

    eureka_server

    Demo project for Spring Boot

 

   

        org.springframework.boot

        spring-boot-starter-parent

        2.0.3.RELEASE

       

   

 

   

        UTF-8

        UTF-8

        1.8

        Finchley.RELEASE

   

 

   

       

            org.springframework.cloud

            spring-cloud-starter-netflix-eureka-server

       

 

       

            org.springframework.boot

            spring-boot-starter-test

            test

       

   

 

   

       

           

                org.springframework.cloud

                spring-cloud-dependencies

                ${spring-cloud.version}

                pom

                import

           

       

   

 

   

       

           

                org.springframework.boot

                spring-boot-maven-plugin

           

       

   

 

 

 

2. applicatin.yml

server:

  port: 8761

 

eureka:

  instance:

    hostname: localhost

  client:

  #声明自己是个服务端

    registerWithEureka: false

    fetchRegistry: false

    serviceUrl:

      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

 

#  server:

#    enable-self-preservation: false

 

3.App.java

@EnableEurekaServer

@SpringBootApplication

public class App{

  public static void main(String[] args){

  SpringAppliaction.run(App.class,args);

 

}

你可能感兴趣的:(springcloud)