RedisThread.java 728 B

123456789101112131415161718192021222324
  1. package com.yihu.wlyy.redis;
  2. import com.yihu.wlyy.util.SystemConf;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.beans.factory.annotation.Value;
  5. import org.springframework.stereotype.Component;
  6. import redis.clients.jedis.Jedis;
  7. /**
  8. * Created by Trick on 2017/8/7.
  9. */
  10. @Component
  11. public class RedisThread implements Runnable {
  12. @Value("${spring.redis.host}")
  13. private String url;
  14. @Autowired
  15. private RedisMsgPubSubListener redisMsgPubSubListener;
  16. @Override
  17. public void run() {
  18. Jedis jedis = new Jedis(url);
  19. jedis.subscribe(redisMsgPubSubListener, SystemConf.getInstance().getSystemProperties().getProperty("redis_prescription_title"));
  20. }
  21. }