踩坑日记:Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class

Redis first contact with the spring session, apart from anything else, start looking at various tutorials on CSDN, then all kinds of Ctrl + c.
First pom.xml, add two dependencies, a lot of Bowen list only a

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.session</groupId>
    <artifactId>spring-session-data-redis</artifactId>
</dependency>

Next, the configuration file application.properties.

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=123
spring.redis.database=0

Pit: password here if redis no password fill in the blank, because the installation redis default password is blank, and then into the following this ok.

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=
spring.redis.database=0

Finally, spring boot startup class Application add comments @EnableRedisHttpSession

@SpringBootApplication
@EnableRedisHttpSession
public class Application extends WebMvcConfigurationSupport {

    public static void main(String[] args){

        SpringApplication.run(Application.class,args);

    }
}

end!

Published 24 original articles · won praise 11 · views 5424

Guess you like

Origin blog.csdn.net/weixin_44037376/article/details/96839369