springcloud --- how2java-- recorded piecemeal information

 

SPRINGCLOUD textbook series (five) - Registration Service Center

eureka:
   instance:
     hostname: localhost
   client:
     registerWithEureka: false
     fetchRegistry: false
     serviceUrl:
       defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
spring:
   application:
     name: eureka-server
hostname: localhost indicates the host name.
registerWithEureka: false representation is registered to the server. Since it is the server itself, so there is no need to register itself to the server.
fetchRegistry:. false indicates whether to obtain registration information server, and above the same token, there are also set to false.
defaultZone: http: // $ {eureka.instance.hostname }: $ {server.port} / eureka / herself as a server, released out of the address. For example, a micro-service follow-up should register themselves to eureka server, then they would use this address: http: // localhost: 8761 / eureka /
name: eurka-server service name itself indicates that the micro is eureka-server
 
 

SPRINGCLOUD textbook series (six) - Micro registration data services product-data-service

execAsync asynchronous method returns a value

A representative of Future operations performed asynchronously, the results of the operation can be obtained by get () method, if the asynchronous operation has not been completed, then, get () causes the current thread blocked

Future <Integer> = ThreadUtil.execAsync Future (() -> {
                 int P = 0 ; 
                System.out.println ( "Please enter the port number within 5 seconds, the recommended 8001, 8002 or 8003, more than 5 seconds will default "+ DefaultPort); 
                Scanner Scanner = new new Scanner (the System.in);
                 the while ( to true ) { 
                    String strPort = scanner.nextLine ();
                     IF ! ( NumberUtil.isInteger (strPort)) { 
                        System.err.println ( " only a digital " );
                         Continue ; 
                    }
                    else {
                        p = Convert.toInt(strPort);
                        scanner.close();
                        break;
                    }
                }
                return p;
        });
View Code

Name Set Micro services: product-data-service
address setting registry: http: // localhost: 8761 / eureka /, and eureka-server configuration  application.yml  echoed

#   server:
#   port: 因为会启动多个 product-data-service, 所以端口号由用户自动设置,推荐 8001,8002,8003
 
spring:
   application:
     name: product-data-service
eureka:
   client:
     serviceUrl:
       defaultZone: http://localhost:8761/eureka/
 

SPRINGCLOUD textbook series (seven) - View Micro Services -RIBBON

 

 

 

 
 
 
 
 

Guess you like

Origin www.cnblogs.com/woainixxx/p/11080202.html