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

Spring boot reactive redis connection

$
0
0

I am new to redis reactive implementation. I am trying to setup a backend which utilises redis on localhost:6379 (default location). Now the documentation stated "We do not need to add any code for configuration if want to connect to a Redis server at localhost:6379."

So i started my redis as usual:

enter image description here

made a simple post request

{"uid":"123","message":"hello world"}

to this controller

@PostMapping("/api/v1/space/post/")@ResponseBodypublic ResponseEntity<String> postMessage(@RequestBody Message message) throws Exception {    if(messageService.postMessage(message.getUid(), message.getMessage())){        return ResponseEntity.ok("it works!");    } else{        return ResponseEntity.badRequest().body("something's wrong");    }}

Everything went fine, the log even stated that the hash has been created. But, when i do redis-cli and check for any keys, nothing is there.

enter image description here

I also tried to connect using LettuceConnectionFactory

    @Beanpublic ReactiveRedisConnectionFactory reactiveRedisConnectionFactory() {    return new LettuceConnectionFactory("localhost", 6379);}

Yet no luck, I am guessing that the spring boot is somehow connected to an embedded redis which is not what I want, so how do I connect to a redis instance?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>