Eureka service configuration (registry)

Description: According to Part I know Restful distributed architecture, based on the Rest now has achieved a basic design architecture for Part programming is the direct use of SpringBoot client direct access to the SpringCloud server, you need to be clear at this time You know the host address of the server before they can be called micro-services, but the host address of the event has changed? If the articles that mode we need to manually modify all micro-service host address, so maintenance costs are too high, so we need to introduce a registration center that all micro-services to register with the registry, then the client obtains based registry micro information services. So we must use Eureka, once the project in order to introduce Eureka, it means that we need to accept SpringCloud project management, and that is: now we must go in projects related to the introduction of dependent SpringCloud.

1. [micro] go inside the parent project reference SpringCloud dependent libraries:

            <dependency> 
                <the groupId> org.springframework.cloud </ the groupId> 
                <the artifactId> Cloud-Spring-Dependencies </ the artifactId> 
                <Version> Dalston.SR5 </ Version> 
                <type> POM </ type> 
                <scope> Import < / scope> 
            </ dependency>     
// current project has been successfully introduced SpringCloud dependent, then we can use SpringCloud make all Rest micro-management services.

Eureka Service set up: If you want to use in the Eureka project, only need to introduce the appropriate dependencies, while establishing appropriate project to direct good start.

2. [micro-eureka-7001] will have to be introduced into the introduction Eureka dependent libraries:

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
        </dependency>

3. [micro-eureka-7001] to modify the program to start classes, append a comment Eureka start:

 

Guess you like

Origin www.cnblogs.com/wxl123/p/11261455.html