Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

How to inject StringRedisTemplate in Micronaut?

$
0
0

I tried to create a redis manager for checking if the Id is already present in redis or not .For that,i injected StringRedisTemplate -

@Singletonpublic class RedisManager {    @Inject    private StringRedisTemplate redisTemplate;    public String getKey(String userProfileId) {        return redisTemplate.opsForValue().get(getRedisKey(Id));    }}

But on trying GET request,I get this error-

"message": "Internal Server Error: Failed to inject value for field [redisTemplate] of class: com.micronaut.oyomoney.redis.RedisManager\n\nPath Taken: BookController.BookService --> $BookServiceDefinition$Intercepted.redisManager --> RedisManager.redisTemplate"

How can I resolve this?


Viewing all articles
Browse latest Browse all 2203

Trending Articles