📌 Error Message

 

Error creating bean with name 'gameStartSetRepository2' defined in com.example.namoldak.repository.GameStartSetRepository2 defined in @EnableRedisRepositories declared on RedisRepositoriesRegistrar.EnableRedisRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.mapping.MappingException: Entity com.example.login.entity. Token requires to have an explicit id field. Did you forget to provide one using @Id?

 

 

📍문제 상황

 

Redis Repository를 Bean 으로 등록이 안되면서 실행이 안되는 에러가 발생!!

 

 

📍원인 

 

아래처럼 레디스에 저장해야할 객체 안에서 Id의 어노테이션의 임포트를 하는 데 잘못 임포트해서 생긴 것!

 

 

📍 해결 

 

위에 보면 javax.persistence.Id; 가 임포트 되어 있는 데 이건 JpaRepository에서 사용했던 거고

CrudRepository를 사용할 거면 org.springframework.data.annotation 을 임포트하면 해결된다!

 

'Database > Redis' 카테고리의 다른 글

Redis] 만료 시간 설정  (0) 2023.01.27

+ Recent posts