Spring Cloud project construction (two)

Create a simple Spring boot project and add the project to the registry.

Create a maven project called System.
Import the eureka-client package in pom.xml.

 <dependencies>
 		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
    </dependencies>

Register Eureka in the application

@SpringBootApplication
@EnableEurekaClient
public class SystemApplication {
    
    
} 

Set the port and name in application.yaml, and the default registry address

spring:
  application:
    name: System
server:
  port: 9001
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/

Guess you like

Origin blog.csdn.net/weixin_42789301/article/details/107217252