Spring Boot Eureka Client

Source: Internet
Author: User

Eureka Client

@EnableDiscoveryClient @springbootapplication  Public class demoapplication {    publicstaticvoid  main (string[] args) {        Springapplication.run (demoapplication. class , args);}    }

/hello

@RestController  Public class Hellocontroller {    @RequestMapping ("/hello")    public  String Index () {         return "Hello world!" ;    }}

Application.properties

spring.application.name=hello-service#eureka.client.serviceurl.defaultzone=http://  localhost:1111/eureka/server.port=1117eureka.client.serviceUrl.defaultZone=http://  localhost:1111/eureka/,http://localhost: 1112/eureka/

Pom.xml

<?xml version= "1.0" encoding= "UTF-8"? ><project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http ://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelversion>4.0.0 </modelVersion> <groupId>com.eurekaclient</groupId> <artifactId>demo</artifactId> & Lt;version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>demo</name > <description>demo Project for Spring boot</description> <parent> <groupId>org.springframework.boot</groupId> &        Lt;artifactid>spring-boot-starter-parent</artifactid> <version>2.0.4.RELEASE</version> <relativePath/> <!--lookup parent from repository to </parent> <properties> <pro Ject.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding >UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-c loud.version>finchley.sr1</spring-cloud.version> </properties> <dependencies> <depend Ency> <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-sta rter-netflix-eureka-client</artifactid> </dependency><!--<dependency> <g Roupid>org.springframework.cLoud</groupid> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> &lt ;/dependency>--> <!--represented as Web Engineering--<dependency> <groupid>org.springframewor        K.boot</groupid> <artifactId>spring-boot-starter-web</artifactId> </dependency>            <!--exposure to various indicators-<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependenc Y> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-starter-    test</artifactid> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupid>org.s pringframework.cloud</groupid> <artifactId>spring-cloud-dependencies</artifactId> <version>$ {spring-cloud.version}</version> <type>pom</type> <scope>Import</scope> </dependency> </dependencies> </dependencyManagement> &LT;BUILD&G        T                <plugins> <plugin> <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>

Spring Boot Eureka Client

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.