Skip to content

Commit

Permalink
Merge pull request #416 from softeerbootcamp-2nd/feat/create-redis
Browse files Browse the repository at this point in the history
Feat/create redis
  • Loading branch information
tank3a authored Aug 23, 2023
2 parents cdbdba6 + 28dfadc commit c552d2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion backend/src/main/java/autoever2/cartag/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
Expand All @@ -26,9 +27,16 @@ public class RedisConfig {
@Value("${spring.redis.port}") // application.properties 에서 불러옴
private int port;

@Value("${spring.redis.password}")
private String password;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(host, port);
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration();
redisStandaloneConfiguration.setHostName(host);
redisStandaloneConfiguration.setPort(port);
redisStandaloneConfiguration.setPassword(password);
return new LettuceConnectionFactory(redisStandaloneConfiguration);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void testShare() {
void testBoughtInfo(){
List<BoughtCarDto> allHistorySum = quoteController.getAllHistorySum();

assertEquals(144, allHistorySum.size());
assertEquals(228, allHistorySum.get(0).getCount());
assertEquals(46200000L, allHistorySum.get(1).getTotalPrice());
assertEquals(6, allHistorySum.size());
assertEquals(2, allHistorySum.get(0).getCount());
assertEquals(42300000L, allHistorySum.get(1).getTotalPrice());
}
}

0 comments on commit c552d2d

Please sign in to comment.