Small D Class - New version of the micro-services springcloud + Eureka Docker tutorial _3-06 service registration and discovery of structures Goods Services Client combat

notes


6, service registration and discovery of the Eureka building Goods Services Client combat
    Description: building with goods and services, and service registration to the registry

    1, create a SpirngBoot application, registration and discovery services increased dependence
    2, analog product information stored in memory

    3, a list of interfaces for product development, product details Interface
    
    4, the configuration file to the registry address
        using eureka client-side official document: http: //cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html # netflix-eureka-client-starter

Start

First, a new spring boot application



is initializing

enter the package name and the project name



Eureka Discovery: Discovery and registration services

directly Finish


Server side of the Eureka project first run up


on the inside of the new Service Pack several


go build entity classes, implement serial interfaces

generated getter and setter methods for all attributes of

the entity class reconstructed into initials

defined Service class


implementation class Service of

the method defined inside the class constructor product initialized


when the class is initialized, it will first construct some fake data


to improve controller code

start program

registered


First to modify the format of the configuration file format yml of


plus configuration, indicating that it is registered a net registered configuration
using eureka client official document: http: //cloud.spring.io/spring-cloud-netflix/single/spring- cloud-netflix.html # netflix-eureka- client-starter


 

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/



Name of the service re-configuration

startup service program, because you change the port number


and then access the registry management background

to go to start a service





to start again







, such as a port and back can restart a service

to start the service 3

This starts three services




 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11441103.html