Springcloud Series Research---Eureka service discovery

Source: Internet
Author: User
Tags spring initializr

: Create Project Engineering

New Project

Choose Gradle Here

Direct Next

Continue Next

Finally click Finish

Second: Create Eureka Service Center

Select the project that you created in the first step, and right-click the new--->module

Select Spring Initializr, then next

Enter group, Artifact, and select Gradle Project, then next

Select Eureka Server, then click Next

Enter module name and finish

I've got a couple of hooks in here, and then OK.

Three: Code

The code is simple, just need to add a @enableeurekaserver annotation on the startup application class of the Springboot project, as follows:

1  PackageCom.cloud.microservice.demo.eurekaserver;2 3 Importorg.springframework.boot.SpringApplication;4 Importorg.springframework.boot.autoconfigure.SpringBootApplication;5 ImportOrg.springframework.cloud.netflix.eureka.server.EnableEurekaServer;6 7 @EnableEurekaServer8 @SpringBootApplication9  Public classeurekaserverapplication {Ten  One      Public Static voidMain (string[] args) { ASpringapplication.run (eurekaserverapplication.class, args); -     } -}

Eureka Server configuration file Appication.yml:

1 Server:2port:90903 4 Eureka:5 instance:6 Hostname:localhost7 Client:8Registerwitheureka:false9Fetchregistry:falseTen serviceurl: OneDefaultzone:http://${eureka.instance.hostname}:${server.port}/eureka/

Start the project, open the browser access: http://localhost:9090, the interface is as follows:

Springcloud Series Research---Eureka service discovery

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.