Spring Cloud (Service registration center and service provider – beginner one)

Source: Internet
Author: User

First, create a service registration center

1. Create a Spring boot project

2, the introduction of Eureka-server dependency (can also be created in the project when the Eureka-server service, automatically generate dependencies) Note The version number, the version is not possible to start the error, this time using the DALSTON.SR1 version

  

3. Start the Service Registration center function in the startup class

  

4, under the default settings, the service registry will also try to register itself as a client, so we need to disable its client registration behavior, only need to application.properties add the following configuration in the Q:

  

5. Browser access to localhost:1111 (no task service registration at this time)

  

Second, create the service provider

1. Create spring boot project as above

2. Add Eureka Dependency

  

3. Add annotations to the startup class to activate the Discoveryclient

  

4. Create controller to provide simple Add task

  

5. Modify the configuration file as follows

  

6. Start the service and visit localhost:1111 again.

  

  

  

  

Spring Cloud (Service registration center and service provider – beginner one)

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.