71. $• web.xml 또는 애플리케이션 실행시 Profile 파라
메터를 넘겨서 선택하는 형태
스프링 3.1 기능 적용
72. $• web.xml 또는 애플리케이션 실행시 Profile 파라
메터를 넘겨서 선택하는 형태
스프링 3.1 기능 적용
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>프로파일명</param-value>
</context-param>
또는 애플리케이션 실행시
$ java … -Dspring.profiles.active=프로파일명
73. $• web.xml 또는 애플리케이션 실행시 Profile 파라
메터를 넘겨서 선택하는 형태
스프링 3.1 기능 적용
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>프로파일명</param-value>
</context-param>
또는 애플리케이션 실행시
$ java … -Dspring.profiles.active=프로파일명
• 선택된 Profile을 Spring 프레임워크에서 환경변
수 파일을 직접 선택
74. $• web.xml 또는 애플리케이션 실행시 Profile 파라
메터를 넘겨서 선택하는 형태
mvc-config.xml
<context:property-placeholder location="classpath:META-INF/
config-${spring.profiles.active:local}.properties"/>
스프링 3.1 기능 적용
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>프로파일명</param-value>
</context-param>
또는 애플리케이션 실행시
$ java … -Dspring.profiles.active=프로파일명
• 선택된 Profile을 Spring 프레임워크에서 환경변
수 파일을 직접 선택
77. $• Maven 종속 부분 제거
• 프로퍼티 변경 시 부담감 축소 ( No Build! )
개선 후 장점
78. $• Maven 종속 부분 제거
• 프로퍼티 변경 시 부담감 축소 ( No Build! )
• 스프링 Bean 자체도 Profile 별로 구성 가능
개선 후 장점
79. $• Maven 종속 부분 제거
• 프로퍼티 변경 시 부담감 축소 ( No Build! )
• 스프링 Bean 자체도 Profile 별로 구성 가능
개선 후 장점
<beans profile="prod">
<bean class="abc"/>
<!-- ... -->
</beans>
<beans profile="local">
<bean class="cde"/>
<!-- ... -->
</beans>
85. $
YAML 핵심 장점
• 심플! ( json 비슷 )
• 한글지원!
• 들여쓰기 강제화!
( 파이썬 느낌 !? )
• 하나의 파일에서 문서
를 나눌 수 있는 문법
(---) 지원
service:
name:
LeeSuHong
phone:
"010-‐5482-‐1212"
sex:
'M'
-‐-‐-‐
spring.profiles:
prod1,prod2,prod3
db:
driver:
oracle.jdbc.driver.OracleDriver
url:
jdbc:oracle:thin:@//123.45.67.78:1521/prod
user:
prod
password:
prod1234
-‐-‐-‐
spring.profiles:
test1,test2
db:
driver:
oracle.jdbc.driver.OracleDriver
url:
jdbc:oracle:thin:@//123.45.67.78:1521/dev
user:
devtest
password:
test
86. $
Spring Boot와 YAML
• YAML 문서를 나누는
특징을 Profile기능에
활용
• 하나의 파일에서 여러가
지 Profile을 기술
#공통부분 (모든프로파일의 속성)
---
spring.profiles: prod1,prod2
#상용 서버 관련 속성
---
spring.profiles: test1
# 테스트1 서버 속성
---
spring.profiles: test2
# 테스트2 서버 속성
---
spring.profiles: local
#로컬 관련 속성
117. $
Spring Cloud Config ?
• 환경변수를 제공 해주는 REST API 서버 (필수)와
환경변수를 받는 클라이언트로 구성 (옵션)
• JSON 형식으로 제공 ( 어떤 서버에서도 사용가능 )
• 환경변수 관리 ( GIT, SVN 등 이용 )
• 환경변수에 대한 암복호화 기능 내장
• 다양한 Application, Profile, Version 형태를 지원
121. $
Spring Cloud Config
시스템 구조
Spring
시스템
서버1
Spring Cloud Config Server
Spring
시스템
서버2
NodeJS
시스템
서버3
환경변수 저장소
( GIT, SVN, Database 등 )
Spring Cloud
Config Client
Spring Cloud
Config Client
122. $
Spring Cloud Config
시스템 구조
Spring
시스템
서버1
Spring Cloud Config Server
Spring
시스템
서버2
NodeJS
시스템
서버3
환경변수 저장소
( GIT, SVN, Database 등 )
환경변수 정보
버전 관리
Spring Cloud
Config Client
Spring Cloud
Config Client
123. $
Spring Cloud Config
시스템 구조
Spring
시스템
서버1
Spring Cloud Config Server
Spring
시스템
서버2
NodeJS
시스템
서버3
환경변수 저장소
( GIT, SVN, Database 등 )
JSON API 형태
로 환경변수를 시
스템에 공급
환경변수 정보
버전 관리
Spring Cloud
Config Client
Spring Cloud
Config Client