RedisTemplate不能作为静态变量注入, 否则报空指针.
错误做法: private static RedisTemplate<String, String> template;
@Component public class RedisUtil { @Autowired private RedisTemplate<String, String> template; }