본문 바로가기
푸닥거리

Spring Cloud를 활용한 MSA 설치 및 구성-1

by [김경민]™ ┌(  ̄∇ ̄)┘™ 2022. 7. 24.
728x90

Spring Cloud를 활용한 MSA 설치 및 구성-1

 

 

 

 


spring cloud

https://spring.io/projects/spring-cloud

 

Spring Cloud

Spring Cloud is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio a BOM (Bill of Materials) is published with a curated set of dependencies on the individual project. Go here to r

spring.io

 

 

spring cloud vs kubernetes

 

 


-> jdk-11.0.15.1_windows-x64_bin.exe
-> spring-tool-suite-4-4.15.1.RELEASE-e4.24.0-win32.win32.x86_64.self-extracting.jar
-> apache-maven-3.8.6-bin.zip

jdk 11 설치
maven 압축해제
JAVA_HOME C:\Program Files\Java\jdk-11.0.15.1
Path %JAVA_HOME%\bin
MAVEN_HOME C:\apache-maven-3.8.6
Path %MAVEN_HOME%\bin
명령창 테스트 
java -version
javac -version
mvn

 

 

https://start.spring.io

 

 

캐시경로

C:\Users\HPE\.m2\repository

 

 

 

 

https://projectlombok.org/download
java -jar lombok.jar을 STS에 설치

 

 

http://localhost:8080/v1/organization/optimaGrowth/license/2313202

 

 

eureka server

 

 

 

 

 

 

 

spring.application.name=MyServer
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
server.port=8761

 

 

 

 

 

spring.application.name=MyClient1
server.port=8081
eureka.instance.prefer-ip-address=true
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true



package com.test.myclient1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaClient
@RestController
public class MyClient1Application {

public static void main(String[] args) {
SpringApplication.run(MyClient1Application.class, args);
}
@RequestMapping(value="/")
public String hello() {
return "Eureka Client Application";
}

}

 

 

spring.application.name=MyClient2
server.port=8082
eureka.instance.prefer-ip-address=true
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true

 

spring.application.name=MyClient3
server.port=8083
eureka.instance.prefer-ip-address=true
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true

 

 

 

 

package com.test.myclient3;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.test.myclient3.MyClient3Application;

@SpringBootApplication
@EnableEurekaClient
@RestController
public class MyClient3Application {

public static void main(String[] args) {
SpringApplication.run(MyClient3Application.class, args);
}
@RequestMapping(value="/")
public String hello() {
return "Eureka Client Application #3";
}

}

 

 

 

 

728x90

댓글