Redistemplateデータベースの切り替え
1516 ワード
Redistemplateデータベースの切り替え
Redistemplateはspingbootが持つ操作redisのクラスです
Redistemplateはspingbootが持つ操作redisのクラスです
@Autowired
private RedisTemplate redisTemplate;
@GetMapping("/test")
@ResponseBody
String queryVisitArticleStatistics(Long cgfId){
JedisConnectionFactory connectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
connectionFactory.setDatabase(9);// 9
return "SUCCESS";
}