Java version of Spring Cloud B2B2C o2o social e-commerce - building Eureka Registration Center

One is to create a Spring Boot project named Eureka server and introduce necessary dependencies into pom.xml. The code is as follows.


2. Use the @ EnableEurekaServer annotation to start a service registry to provide dialogue to other applications. You only need to add the following annotation to the Spring Boot application to enable this function.

public class Application {
    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class).web(true).run(args);

3. By default, service registration will try to register itself as a client, so you need to disable its client behavior.

Add the following configuration in
# Close protection mechanism

eureka.client.register-with-eureka: since the app is a registry, setting it to false means that you do not register yourself with the registry.

eureka.client.fetch-registry: since the responsibility of the registry is to maintain the service instance, it does not need to retrieve the service, so it is also set to false.

Keywords: Java Spring xml

Added by mooler on Fri, 18 Oct 2019 21:25:12 +0300