SpringCloud 설정 센터 Config 프로 세 스 분석
설정 을 통일 적 으로 관리 하고,각 환경의 설정 을 빠르게 전환 합 니 다.
관련 제품:
바 이 두 의 discont
https://github.com/knightliao/disconf
아 리 의 다이아몬드
https://github.com/takeseem/diamond
springcloud 의 configs-server:
http://cloud.spring.io/spring-cloud-config/
2.의존 도 추가
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
3.클래스 시작 에 주석 추가@EnableConfigServer
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class ConfigServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServiceApplication.class, args);
}
}
4.application.yml 설정 수정
server:
port: 9100
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
application:
name: config-server
cloud:
config:
server:
git:
# , git
uri: https://gitee.com/YTHeng/config_cloud
#git ,
username: [email protected]
password: 12345678.
#
timeout: 5
#
default-label: master
5.코드 클 라 우 드 서버 에 새 창고 와 파일 만 들 기6.방문 주소
http://localhost:9100/master/product-service-dev.yml
경로 접근 방식
/{name}-{profiles}. properties
/{name}-{profiles}.yml
/{name}-{profiles}.json
/{label}/{name]-{profiles].yml
name:서버 이름
profile:환경 이름,개발,테스트,생산
Lable:창고 분기,기본 master 분기
첨부:
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[MeU] Hashtag 기능 개발➡️ 기존 Tag 테이블에 존재하지 않는 해시태그라면 Tag , tagPostMapping 테이블에 모두 추가 ➡️ 기존에 존재하는 해시태그라면, tagPostMapping 테이블에만 추가 이후에 개발할 태그 기반 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.