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

Quarkus Redis client not using host from application.properties

$
0
0

Using Quarkus 1.12.2Final, the Redis client is not using the config properties I set for it in application.properties

application.properties content:

%dev.quarkus.redis.hosts=redis://redis_dev:6379%prod.quarkus.redis.hosts=redis://redis_prod:6379

Neither host exists so I should get a connection failure. I wrap the Redis client in another class that prints the config:

import io.quarkus.redis.client.RedisClient;    @ApplicationScoped    public class RedisClientWrapper {        private static final Logger LOG = Logger.getLogger(RedisClientWrapper.class);        public RedisClientWrapper() {        }        @ConfigProperty(name = "quarkus.redis.hosts")        String redisHost;        @Inject        RedisClient redisClient;        @PostConstruct        void init(){                LOG.info("Redis client initialized. Configured host: "+redisHost);        }

When running the app, this is the output:

2021-03-25 18:46:47,517 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.2021-03-25 18:47:02,609 INFO  [RedisClientWrapper] (executor-thread-1) Redis client initialized. Configured host: redis://redis_dev:6379

The app however connects to my redis running on localhost, and everything works.

By running it as a JAR,

./mvnw packagejava -jar target/quarkus-app/quarkus-run.jar

I run it with the prod profile

2021-03-25 18:50:26,620 INFO  [io.quarkus] (main) Profile prod activated. 2021-03-25 18:50:37,555 INFO  [RedisClientWrapper] (executor-thread-1) Redis client initialized. Configured host: redis://redis_prod:6379

Still same behaviour, the Redis client connects to localhost.

Why does the Redis client not use the host name specified in the config?


Viewing all articles
Browse latest Browse all 2222


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