SpringBoot启动类增加注解
@EnableRedisHttpSession
@SpringBootApplication
@ImportResource({"classpath:config/applicationContext-xweb-dubbo.xml"
,"classpath:config/applicationContext-xweb.xml"
,"classpath:config/applicationContext-jedis.xml"})
@Configuration
@ComponentScan
@EnableRedisHttpSession
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, RedisAutoConfiguration.class})
public class XwebApplication extends WebMvcConfigurerAdapter {
}
application.properties
spring.redis.host=192.16.8.126
spring.redis.port=6379
spring.redis.password=cor2017
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.1.0.RELEASE</version>
<type>pom</type>
</dependency>