--- kind: CONCEPT slug: adapter-outbound-cache-redis-c01 title: 꺼져 있을 때 아무것도 기여하지 않는다는 말이 문자 그대로다 topic: composition-and-lifecycle-models project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:adapter-outbound-cache-redis-c01 evidenceCapturedOn: 2026-09-01 assets: - key: adapter-outbound-cache-redis-c01 file: ../../../final/evidence/rendered/adapter-outbound-cache-redis-c01.svg - key: adapter-outbound-cache-redis-c01-diagram file: ../../../final/assets/diagrams/adapter-outbound-cache-redis-c01.svg evidence: - ../../../final/evidence/raw/adapter-outbound-cache-redis-c01.txt source: - 원본 분석 절은 analysis/10-adapter-outbound-cache-redis.md#L85 이다. module: adapter-outbound-cache-redis --- # 꺼져 있을 때 아무것도 기여하지 않는다는 말이 문자 그대로다 `RedisSdkSettings`가 애플리케이션 전역 `@ConfigurationPropertiesScan`이 아니라 `RedisSdkAutoConfiguration`의 `@Bean`으로만 존재한다. 그래서 스위치가 꺼져 있으면 속성이 묶이지도 않는다. ## 본문 `RedisSdkAutoConfiguration`의 javadoc이 규칙을 적는다. > "`app.redis.enabled` is the whole switch. While it is false this class contributes nothing, and because `RedisSdkSettings` is registered here rather than by the application-wide `@ConfigurationPropertiesScan`, **'contributes nothing' is literal**: the properties are not bound, the cross-field rules are not run, no credential is resolved, and no policy resource, TLS material, client, connection or thread is created." ## 조립이 고정된 순서 :::evidence key="adapter-outbound-cache-redis-c01-diagram" alt="설정 바인딩과 교차 필드 검증과 클라이언트 생성이 왼쪽에서 오른쪽으로 이어지고 화살표에 bound settings 와 검증 통과가 붙은 구조" caption="조립이 고정된 순서" zoom="false" ::: `RedisSdkSettings`는 `@ConfigurationPropertiesScan` 대상이 아니라 이 클래스의 `@Bean` + `@ConfigurationProperties`로만 존재한다. 그래서 Redis를 쓰지 않는 배포는 Redis 설정을 들고 다니지 않고, **켠 적 없는 잘못된 Redis 설정 때문에 벌을 받지도 않는다**. test가 그 넷을 이름으로 고정한다 — `absentSwitchRegistersNothing`, `disabledRegistersNothing`, `disabledIgnoresMalformedRedisConfiguration`, `disabledNeverAsksForASecretOrAConnection`. ## RedisSdkAutoConfiguration 참조 위치 :::evidence key="adapter-outbound-cache-redis-c01" alt="코드베이스에서 RedisSdkAutoConfiguration 를 검색한 출력 30줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="RedisSdkAutoConfiguration 코드베이스 검색 — 30줄 · exit 0" zoom="true" ::: ## 검증이 bean factory 메서드 안에 있는 이유 순서도 bind → validate → build로 고정된다. 검증이 `@PostConstruct`나 리스너가 아니라 **bean factory 메서드 안**에 있어서, 설정 오류가 "그 bean을 만들지 못했다"는 실패로 보고되고 그 아래 어떤 것도 검증되지 않은 settings를 잡을 수 없다. 그리고 `redisSdkSettingsValidation`이 별도 bean인 이유도 적혀 있다 — Spring은 factory 메서드가 **반환한 뒤에** binder를 돌리므로 검증이 `redisSdkSettings()` 안에 있을 수 없다.