@@ -17,35 +17,37 @@ For examples on using the Spring Data Key Value, see the dedicated project, also
17
17
18
18
# Artifacts
19
19
20
- * Maven:
20
+ ## Maven configuration
21
21
22
- ~~~~~ xml
22
+ Add the Maven dependency:
23
23
24
+ ``` xml
24
25
<dependency >
25
26
<groupId >org.springframework.data</groupId >
26
27
<artifactId >spring-data-redis</artifactId >
27
- <version >${version}</version >
28
- </dependency >
28
+ <version >${version}.RELEASE</version >
29
+ </dependency >
30
+ ```
29
31
30
- <!-- used for nightly builds -->
31
- <repository >
32
- <id >spring-maven-snapshot</id >
33
- <snapshots ><enabled >true</enabled ></snapshots >
34
- <name >Springframework Maven SNAPSHOT Repository</name >
35
- <url >http://repo.spring.io/libs-release</url >
36
- </repository >
32
+ If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
33
+
34
+ ``` xml
35
+ <dependency >
36
+ <groupId >org.springframework.data</groupId >
37
+ <artifactId >spring-data-redis</artifactId >
38
+ <version >${version}.BUILD-SNAPSHOT</version >
39
+ </dependency >
37
40
38
- <!-- used for milestone/rc releases -->
39
41
<repository >
40
- <id >spring-maven-milestone </id >
41
- <name >Springframework Maven Milestone Repository</name >
42
- <url >http://repo.spring.io/libs-milestone </url >
43
- </repository >
44
- ~~~~~
42
+ <id >spring-libs-snapshot </id >
43
+ <name >Spring Snapshot Repository</name >
44
+ <url >http://repo.spring.io/libs-snapshot </url >
45
+ </repository >
46
+ ```
45
47
46
- * Gradle:
48
+ ## Gradle
47
49
48
- ~~~~~ groovy
50
+ ``` groovy
49
51
repositories {
50
52
maven { url "http://repo.spring.io/libs-milestone" }
51
53
maven { url "http://repo.spring.io/libs-snapshot" }
@@ -55,13 +57,13 @@ repositories {
55
57
dependencies {
56
58
compile "org.springframework.data:spring-data-redis:${version}"
57
59
}
58
- ~~~~~
60
+ ```
59
61
60
62
# Usage (for the impatient)
61
63
62
64
* Configure the Redis connector to use (here [ jedis] ( https://github.com/xetorthio/jedis ) ):
63
65
64
- ~~~~~ xml
66
+ ``` xml
65
67
<beans xmlns =" http://www.springframework.org/schema/beans"
66
68
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
67
69
xmlns : p =" http://www.springframework.org/schema/p"
@@ -73,22 +75,22 @@ dependencies {
73
75
<bean id =" redisTemplate" class =" org.springframework.data.redis.core.RedisTemplate"
74
76
p : connection-factory =" jedisFactory" />
75
77
</beans >
76
- ~~~~~
78
+ ```
77
79
78
80
* Use ` RedisTemplate ` to interact with the Redis store:
79
81
80
- ~~~~~ java
82
+ ``` java
81
83
String random = template. randomKey();
82
84
template. set(random, new Person (" John" , " Smith" ));
83
- ~~~~~
85
+ ```
84
86
85
87
* Use Redis 'views' to execute specific operations based on the underlying Redis type:
86
88
87
- ~~~~~ java
89
+ ``` java
88
90
ListOperations<String , Person > listOps = template. listOps();
89
91
listOps. rightPush(random, new Person (" Jane" , " Smith" ));
90
92
List<Person > peopleOnSecondFloor = listOps. range(" users:floor:2" , 0 , - 1 );
91
- ~~~~~
93
+ ```
92
94
93
95
# Building
94
96
0 commit comments