Update Samples and Guides to use Lettuce
Favor lettuce because of multiplexing and improved scalability. Using lettuce requires a fixed number of connections hence using lettuce improves application scalability. Fixes gh-652
This commit is contained in:
@@ -43,7 +43,7 @@ dependencies {
|
|||||||
"org.springframework:spring-test:$springVersion",
|
"org.springframework:spring-test:$springVersion",
|
||||||
"org.assertj:assertj-core:$assertjVersion",
|
"org.assertj:assertj-core:$assertjVersion",
|
||||||
"com.hazelcast:hazelcast:$hazelcastVersion",
|
"com.hazelcast:hazelcast:$hazelcastVersion",
|
||||||
"redis.clients:jedis:2.4.1",
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"javax.servlet:javax.servlet-api:$servletApiVersion"
|
"javax.servlet:javax.servlet-api:$servletApiVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ asciidoctor {
|
|||||||
'download-url' : "https://github.com/spring-projects/spring-session/archive/${ghTag}.zip",
|
'download-url' : "https://github.com/spring-projects/spring-session/archive/${ghTag}.zip",
|
||||||
'spring-session-version' : version,
|
'spring-session-version' : version,
|
||||||
'spring-version' : springVersion,
|
'spring-version' : springVersion,
|
||||||
|
'lettuce-version' : lettuceVersion,
|
||||||
'hazelcast-version' : hazelcastVersion,
|
'hazelcast-version' : hazelcastVersion,
|
||||||
'docs-itest-dir' : rootProject.projectDir.path + '/docs/src/integration-test/java/',
|
'docs-itest-dir' : rootProject.projectDir.path + '/docs/src/integration-test/java/',
|
||||||
'docs-test-dir' : rootProject.projectDir.path + '/docs/src/test/java/',
|
'docs-test-dir' : rootProject.projectDir.path + '/docs/src/test/java/',
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ If you are using Maven, ensure to add the following dependencies:
|
|||||||
<version>{spring-session-version}</version>
|
<version>{spring-session-version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>biz.paluch.redis</groupId>
|
||||||
|
<artifactId>lettuce</artifactId>
|
||||||
|
<version>{lettuce-version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
@@ -129,7 +134,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ If you are using Maven, ensure to add the following dependencies:
|
|||||||
<version>{spring-session-version}</version>
|
<version>{spring-session-version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>biz.paluch.redis</groupId>
|
||||||
|
<artifactId>lettuce</artifactId>
|
||||||
|
<version>{lettuce-version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
@@ -121,7 +126,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ If you are using Maven, ensure to add the following dependencies:
|
|||||||
<version>{spring-session-version}</version>
|
<version>{spring-session-version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>biz.paluch.redis</groupId>
|
||||||
|
<artifactId>lettuce</artifactId>
|
||||||
|
<version>{lettuce-version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
@@ -122,7 +127,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ If you are using Maven, ensure to add the following dependencies:
|
|||||||
<version>{spring-session-version}</version>
|
<version>{spring-session-version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>biz.paluch.redis</groupId>
|
||||||
|
<artifactId>lettuce</artifactId>
|
||||||
|
<version>{lettuce-version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
@@ -126,7 +131,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ include::{samples-dir}websocket/src/main/java/sample/config/WebSecurityConfig.ja
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
||||||
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
|
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
|
||||||
====
|
====
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.hazelcast.core.HazelcastInstance;
|
|||||||
import com.hazelcast.core.IMap;
|
import com.hazelcast.core.IMap;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
import org.springframework.mock.web.MockServletContext;
|
import org.springframework.mock.web.MockServletContext;
|
||||||
@@ -110,7 +110,7 @@ public class IndexDocTests {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void newRedisOperationsSessionRepository() {
|
public void newRedisOperationsSessionRepository() {
|
||||||
// tag::new-redisoperationssessionrepository[]
|
// tag::new-redisoperationssessionrepository[]
|
||||||
JedisConnectionFactory factory = new JedisConnectionFactory();
|
LettuceConnectionFactory factory = new LettuceConnectionFactory();
|
||||||
SessionRepository<? extends ExpiringSession> repository = new RedisOperationsSessionRepository(
|
SessionRepository<? extends ExpiringSession> repository = new RedisOperationsSessionRepository(
|
||||||
factory);
|
factory);
|
||||||
// end::new-redisoperationssessionrepository[]
|
// end::new-redisoperationssessionrepository[]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ version=1.3.0.BUILD-SNAPSHOT
|
|||||||
# TODO: upgrade to SD Redis 1.7.4.RELEASE - spring3Test suite Redis tests fail due to upgrade...
|
# TODO: upgrade to SD Redis 1.7.4.RELEASE - spring3Test suite Redis tests fail due to upgrade...
|
||||||
# Caused by: java.lang.NoSuchMethodError: org.springframework.core.serializer.support.DeserializingConverter.<init>(Ljava/lang/ClassLoader;)V
|
# Caused by: java.lang.NoSuchMethodError: org.springframework.core.serializer.support.DeserializingConverter.<init>(Ljava/lang/ClassLoader;)V
|
||||||
springDataRedisVersion=1.7.1.RELEASE
|
springDataRedisVersion=1.7.1.RELEASE
|
||||||
|
lettuceVersion=3.5.0.Final
|
||||||
html5ShivVersion=3.7.3
|
html5ShivVersion=3.7.3
|
||||||
commonsLoggingVersion=1.2
|
commonsLoggingVersion=1.2
|
||||||
junitVersion=4.12
|
junitVersion=4.12
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework:spring-web:$springVersion",
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "org.springframework:spring-web:$springVersion",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.webjars:bootstrap:$bootstrapVersion",
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
||||||
jstlDependencies
|
jstlDependencies
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package sample;
|
package sample;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||||
import org.springframework.session.web.http.CookieSerializer;
|
import org.springframework.session.web.http.CookieSerializer;
|
||||||
import org.springframework.session.web.http.DefaultCookieSerializer;
|
import org.springframework.session.web.http.DefaultCookieSerializer;
|
||||||
@@ -26,8 +26,8 @@ import org.springframework.session.web.http.DefaultCookieSerializer;
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory();
|
return new LettuceConnectionFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag::cookie-serializer[]
|
// tag::cookie-serializer[]
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ dependencies {
|
|||||||
"org.springframework.boot:spring-boot-starter-thymeleaf",
|
"org.springframework.boot:spring-boot-starter-thymeleaf",
|
||||||
"org.springframework.boot:spring-boot-starter-security",
|
"org.springframework.boot:spring-boot-starter-security",
|
||||||
"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect",
|
"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.apache.httpcomponents:httpclient"
|
"org.apache.httpcomponents:httpclient"
|
||||||
|
|
||||||
testCompile "org.springframework.boot:spring-boot-starter-test",
|
testCompile "org.springframework.boot:spring-boot-starter-test",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
import org.springframework.security.jackson2.SecurityJackson2Modules;
|
import org.springframework.security.jackson2.SecurityJackson2Modules;
|
||||||
@@ -39,8 +39,8 @@ public class SessionConfig implements BeanClassLoaderAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory();
|
return new LettuceConnectionFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework:spring-web:$springVersion",
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "org.springframework:spring-web:$springVersion",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.webjars:bootstrap:$bootstrapVersion",
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
||||||
jstlDependencies
|
jstlDependencies
|
||||||
|
|||||||
@@ -13,6 +13,6 @@
|
|||||||
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
|
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
|
||||||
|
|
||||||
<!--2-->
|
<!--2-->
|
||||||
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"/>
|
<bean class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory"/>
|
||||||
<!-- end::beans[] -->
|
<!-- end::beans[] -->
|
||||||
</beans>
|
</beans>
|
||||||
@@ -3,8 +3,11 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework:spring-web:$springVersion",
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "org.springframework:spring-web:$springVersion",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.webjars:bootstrap:$bootstrapVersion",
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
||||||
jstlDependencies
|
jstlDependencies
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package sample;
|
package sample;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||||
|
|
||||||
// tag::class[]
|
// tag::class[]
|
||||||
@@ -25,8 +25,8 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory(); // <2>
|
return new LettuceConnectionFactory(); // <2>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end::class[]
|
// end::class[]
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.springframework:spring-webmvc:$springVersion",
|
"org.springframework:spring-webmvc:$springVersion",
|
||||||
"org.springframework.security:spring-security-config:$springSecurityVersion",
|
"org.springframework.security:spring-security-config:$springSecurityVersion",
|
||||||
"org.springframework.security:spring-security-web:$springSecurityVersion",
|
"org.springframework.security:spring-security-web:$springSecurityVersion",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package sample;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||||
import org.springframework.session.web.http.HeaderHttpSessionStrategy;
|
import org.springframework.session.web.http.HeaderHttpSessionStrategy;
|
||||||
import org.springframework.session.web.http.HttpSessionStrategy;
|
import org.springframework.session.web.http.HttpSessionStrategy;
|
||||||
@@ -29,8 +29,8 @@ import org.springframework.session.web.http.HttpSessionStrategy;
|
|||||||
public class HttpSessionConfig {
|
public class HttpSessionConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory(); // <2>
|
return new LettuceConnectionFactory(); // <2>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework:spring-web:$springVersion",
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "org.springframework:spring-web:$springVersion",
|
||||||
"org.springframework.security:spring-security-config:$springSecurityVersion",
|
"org.springframework.security:spring-security-config:$springSecurityVersion",
|
||||||
"org.springframework.security:spring-security-web:$springSecurityVersion",
|
"org.springframework.security:spring-security-web:$springSecurityVersion",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.webjars:bootstrap:$bootstrapVersion",
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
||||||
jstlDependencies
|
jstlDependencies
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package sample;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||||
|
|
||||||
// tag::class[]
|
// tag::class[]
|
||||||
@@ -27,8 +27,8 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory(); // <2>
|
return new LettuceConnectionFactory(); // <2>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end::class[]
|
// end::class[]
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ apply from: TOMCAT_7_GRADLE
|
|||||||
apply from: SAMPLE_GRADLE
|
apply from: SAMPLE_GRADLE
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework:spring-web:$springVersion",
|
exclude module: 'jedis'
|
||||||
"org.webjars:bootstrap:3.3.6",
|
}
|
||||||
|
compile "org.springframework:spring-web:$springVersion",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
"org.webjars:webjars-taglib:$webjarsTaglibVersion",
|
||||||
jstlDependencies
|
jstlDependencies
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package sample;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,8 +31,8 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory();
|
return new LettuceConnectionFactory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end::class[]
|
// end::class[]
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ apply from: SAMPLE_GRADLE
|
|||||||
group = 'samples'
|
group = 'samples'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':spring-session-data-redis'),
|
compile(project(':spring-session-data-redis')) {
|
||||||
"org.springframework.boot:spring-boot-starter-web",
|
exclude module: 'jedis'
|
||||||
|
}
|
||||||
|
compile "org.springframework.boot:spring-boot-starter-web",
|
||||||
"org.springframework.boot:spring-boot-starter-data-jpa",
|
"org.springframework.boot:spring-boot-starter-data-jpa",
|
||||||
"org.springframework.boot:spring-boot-starter-thymeleaf",
|
"org.springframework.boot:spring-boot-starter-thymeleaf",
|
||||||
"org.springframework.boot:spring-boot-starter-websocket",
|
"org.springframework.boot:spring-boot-starter-websocket",
|
||||||
@@ -25,6 +27,7 @@ dependencies {
|
|||||||
"org.springframework.data:spring-data-jpa",
|
"org.springframework.data:spring-data-jpa",
|
||||||
"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect",
|
"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect",
|
||||||
"org.thymeleaf.extras:thymeleaf-extras-conditionalcomments",
|
"org.thymeleaf.extras:thymeleaf-extras-conditionalcomments",
|
||||||
|
"biz.paluch.redis:lettuce:$lettuceVersion",
|
||||||
"org.webjars:bootstrap:$bootstrapVersion",
|
"org.webjars:bootstrap:$bootstrapVersion",
|
||||||
"org.webjars:html5shiv:$html5ShivVersion",
|
"org.webjars:html5shiv:$html5ShivVersion",
|
||||||
"org.webjars:knockout:2.3.0",
|
"org.webjars:knockout:2.3.0",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import javax.sql.DataSource;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public class DataSourceConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public LettuceConnectionFactory connectionFactory() {
|
||||||
return new JedisConnectionFactory();
|
return new LettuceConnectionFactory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user