tianyun 2 gadi atpakaļ
vecāks
revīzija
9587d06c85

+ 4 - 25
springboot-main/src/main/java/com/alvin/Application.java

@@ -1,33 +1,12 @@
 package com.alvin;
 
 
-import redis.clients.jedis.*;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+@SpringBootApplication
 public class Application {
     public static void main(String[] args) throws Exception {
-
-        Set<String> hosts = new HashSet<>();
-        hosts.add("127.0.0.1:26379");
-        //hosts.add("127.0.0.1:36379"); 配置多个哨兵
-
-        JedisSentinelPool pool = new JedisSentinelPool("mymaster", hosts);
-        pool.setMaxTotal(10);
-        Jedis jedis = null;
-
-        for (int i = 0; i < 20; i++) {
-            Thread.sleep(2000);
-            try {
-                jedis = pool.getResource();
-                String v = "hi" + i;
-                jedis.set("hello", v);
-                System.out.println(v + "-->" + jedis.get("hello").equals(v));
-            } catch (Exception e) {
-                System.out.println(" [ exception happened]" + e);
-            }
-        }
+        SpringApplication.run(Application.class);
     }
 }