1. config-server
application.java
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
application.yml 파일
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: file://C:\DevSoo\MSABackend\config-resource
2. config-resoure 폴더 내 test-db.yml 파일
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/msa_db
username: 사용자명
password: 비밀번호
dirver-class-name: com.mysql.cj.jdbc.Driver # .cj.이 붙는 것은 5버전 이상으로 cj 미작성 시 호환은 되지만, 지원하지는 않습니다.
3. config-client
bootstrap.yml 파일
spring:
cloud:
config:
uri: http://127.0.0.1:8888
name: test-db
build.gradle 설정
dependencies {
// spring-cloud-starter-config
implementation 'org.springframework.cloud:spring-cloud-starter-config:4.0.4'
// spring-cloud-starter-bootstrap
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:4.0.4'
}
4. 결과
차후 Kohl's Admin Infinity (콜스 어드) 설정하기를 통해 보완을 유지하면서 config서버를 활용할 수 있습니다..
'MSA' 카테고리의 다른 글
개별 마이크로 서비스 간 통신 (1) | 2023.11.06 |
---|---|
Github 레포지토리 config 서버 연동 (0) | 2023.11.01 |
Spring Cloud Config 서버를 활용한 연동 (1) | 2023.11.01 |
JAVA 객체로 먼저 보는Join 없는 연관 관계 이해하기 (0) | 2023.10.30 |
디스커버리 서버와 유레카 적용 사례 (0) | 2023.10.25 |