Springcloud's study (i) Registration and discovery of services

Source: Internet
Author: User

Stones

Know Springcloud for a long time, but has not been learning and practice, just these two days have this impulse, then the strike ...!!!!!

After searching for some information, I found a simple and easy-to-use series of blog http://blog.csdn.net/forezp/article/details/70148833 to take this practiced hand .... Thanks to the knowledge and sharing of the predecessors

————————————————————————————————————————————————————————————————————

1, create the project, I use the IDE here, multiple projects are created together. Create a way to refer to the blog of the Great God, I will not repeat this step.

2, the service side:

Dependencies required by the service side

 <  dependency      >  <  groupid  >  org.springframework.cloud</ Span style= "COLOR: #800000" >groupid  >   <  artifactid  >  Spring-cloud-starter-eureka-server</  Artifactid  >  </ dependency  >  

Add @EnableEurekaServer annotations to identify this as a Eureka service

After this is started directly, the access page (the default port is 8080) jumps to

Such a page, but the boot process console will error

So you need to add some configuration

Eureka:  instance:    hostname:localhost  client:    register-with-eureka:false    fetch-registry: False    Service-url:      defaultzone:http://${eureka.instance.hostname}:${server.port}/eureka/

Note Both of these: false

3, the Client

Clients need to rely on

< Dependency >    < groupId >org.springframework.cloud</groupId>    <  Artifactid>spring-cloud-starter-eureka</artifactid> </ Dependency >

Plus @EnableEurekaClient identify the client identity

But that's not enough.

The client needs to be registered to the server and the server needs to discover the client

Client-initiated, access to server-side pages

A service was found to be registered. The name and port number are exactly the information that is configured in the client service

============================= to this end, the server and client demo is completed =============================

    • The simplest Springcloud tutorial in history | First article: Registration and discovery of services (Eureka)

Service registration and discovery, name concise, thanks to the predecessors to share

But:

What the hell is this?

—————————————————————————————————————————————————————————————————————————

In any case, calm

Springcloud's study (i) Registration and discovery of services

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.