connection factory
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd6kOst%2Fbtsjmv8tasm%2FRve82r2p0FxXcMm1K0tA0K%2Fimg.png)
[Spring Boot] Spring 에서 Redis 를 사용할 때 ConnectionFactory 를 왜 Bean 으로 등록해서 사용해야 할까?(feat. Kotlin, Lettuce, LettuceConnectionFactory was not initialized through afterPropertiesSet())
발단 RedisTemplate 의 connectionFactory 를 Bean 으로 등록된 RedisConnectionFactory 로 사용하는 예제가 많은데 왜 그래야 하는지 설명이 없어 궁금하여 찾아보게 되었다. (Bean 으로 등록하여 사용하지 않으면 `LettuceConnectionFactory was not initialized through afterPropertiesSet()` 오류가 발생한다.) 설명 Spring 에서 Redis 서버와의 연결을 위해 getConnection 메서드를 호출한다. getConnection 메서드 내부에는 assertInitialized 검증 메서드를 호출한다. assertIntialized 는 initalized 변수를 통해 초기화 여부를 판단하는데, 해당 변..
728x90