Https://github.com/xetorthio/jedis explains how to add Jedis dependencies to spring boot.
Add the following code under Pom.xml
<dependency>
<groupId>redis.clients</groupId>
<artifactid>jedis</artifactid >
<version>2.8.0</version>
<type>jar</type>
<scope>compile</ Scope>
</dependency>
Adding in the main function
Jedis Jedis = new Jedis ("localhost");
Scanner in=new Scanner (system.in);
while (true) {
String name = In.next ();
String value = jedis.get (name);
System.out.println (value);
}
First install the Redis server and run the Redis Service (Installation method: http://blog.csdn.net/firenet1/article/details/50786562)
Then enable the client to enter a set of data
127.0.0.1:6379> set foo bar
ok
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379>
Then after compiling, input foo in the console will get output bar, at this time the test project can be normal Unicom Redis
Foo
bar
nulx
null
Spring Boot website uses Redis's tutorial address for http://spring.io/guides/gs/messaging-redis/