1. spring boot에서 profile을 끌어가는 방법 : spring core
application.yaml에 등록된 profile 정보가 있다. spring은 여기서 local, dev, staging 등의 정보를 끌어간다. (어떻게?까지는 아직 내 레벨에선 이해하기 어려운 듯... ㅠ)
// application.yaml 파일
---
spring:
config:
activate:
on-profile: local
import: ~/configLocal.yml ...
spring.profiles.active = local
그리고 config.xml파일을 import하고 있는 걸 알 수 있음.
1-1. Profile이란?
Profile은 Bean의 그룹을 말한다. Spring은 다양한 profile을 지정할 수 있고, 필요한 bean을 불러와 사용한다.
@Profile("profile_name")
프로파일에는 논리적 연산자도 사용 가능하다.
- ! : A logical "not" of the profile
- & : A logical "and" of the profiles
- | : A logical "or" of the profiles
https://colabear754.tistory.com/112
https://docs.spring.io/spring-boot/reference/features/profiles.html#features.profiles
2. Naver pasta의 profile 지정 방법
파이프라인 생성 시에 차트 서비스를 작성한다. (chart config) 여기서 key, value 타입으로 지정이 가능하다.
key | value | |
set | ... | |
... | ||
springProfilesActive | local | |
files | .../.../....yaml |
'┝ framework > ┎ Spring' 카테고리의 다른 글
controller에서 파라미터를 받는 방법, @PathVariable과 @RequestBody (0) | 2025.04.22 |
---|---|
Map<Key, Interface>를 이용한 스프링 빈 활용 (0) | 2025.04.09 |
인증, 인가, JWT, Session, OAuth (0) | 2025.02.18 |
spring webflux란? (0) | 2025.02.10 |
[Gradle] build.gradle sourceSet 설정 (feat. resource 디렉터리와 mapper) (0) | 2024.10.19 |