Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA) 강의를 듣고 실습한 내용입니다.
강의와 버전을 다르게 해서 진행했습니다.
개발 환경
OS : Mac OS (M1)
Java : 17
Spring Boot : 3.1.5
Spring Cloud : 2022.0.4
Java 17 설치
dmg 파일 설치 후 실행
Azul Downloads
No matter the size of your company, Azul offers competitive pricing options to fit your needs, your budget, and your ambition.
www.azul.com
프로젝트 생성
IntelliJ 실행 - New Project - Spring initializr - 아래와 같이 입력 후 Next
Name : discoveryservice
Language : Java
Type : Gradle - Groovy
Group : com.example
Artifact : discoveryservice
Package name : com.example.discoveryservice
Project SDK : 17 (zulu-17)
Java : 17
Packaging : Jar
Spring Boot : 3.1.5
Dependencies : Spring Cloud Discovery의 Eureka Server 추가
프로젝트 생성 완료 👏
application.yml 파일 설정
server:
port: 8761
spring:
application:
name: discoveryservice
eureka:
client:
register-with-eureka: false
fetch-registry: false
SpringBootApplication 설정
DiscoveryserviceApplication에 @EnableEurekaServer 어노테이션 추가
package com.example.discoveryservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class DiscoveryserviceApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryserviceApplication.class, args);
}
}
서버 실행
localhost:8761 접속해 대시보드 확인
프로젝트 생성 끝! ✨
https://github.com/jxixeun/discoveryservice
GitHub - jxixeun/discoveryservice: Eureka Discovery Server Practice
Eureka Discovery Server Practice. Contribute to jxixeun/discoveryservice development by creating an account on GitHub.
github.com