Error: Initialization of bean failed khi sử dụng Redis

Mình đang sử dụng Redis nhưng bị lỗi. Mong anh em giúp.

I’m using Redis and created HttpSessionConfig file. Here is my code in HttpSessionConfig.java:

@EnableRedisHttpSession
public class HttpSessionConfig {

	@Bean
	public LettuceConnectionFactory connectionFactory() {

		return new LettuceConnectionFactory();
	}
	
	@Bean
	public HttpSessionIdResolver httpSessionStrategy() {
		return HeaderHttpSessionIdResolver.authenticationInfo();
	}
	
}

And here is my pom.xml file:

	<!-- Redis -->
	<dependency>
		<groupId>org.springframework.session</groupId>
		<artifactId>spring-session-data-redis</artifactId>
	</dependency>

	<dependency>
		<groupId>biz.paluch.redis</groupId>
		<artifactId>lettuce</artifactId>
		<version>4.3.1.Final</version>
	</dependency>

But I got error:

Error creating bean with name 'org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration': Initialization of bean failed

Anyone know how to fix it???

Redis chạy port nào, chỗ nào em cấu hình redis?

1 Like

Theo yêu cầu

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?