question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Named Redis client injection not working when used in separate JAR

See original GitHub issue

Describe the bug We have an application scoped bean, defined in our common project and being used by other services, that utilizes RedisClient:

@ApplicationScoped
public class Service {

    @Inject
    @RedisClientName("second")
    RedisClient redisClient;
    ...
}

This common project is packaged as JAR and then used as a Maven dependency from other services.

We keep getting this error when starting those other services:

javax.enterprise.inject.spi.DeploymentException:
  javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.redis.client.RedisClient and qualifiers [@RedisClientName(value = "second")]

We’ve defined an alternate Redis connection like this:

quarkus.redis.second.hosts=redis://localhost:6379

and made sure it’s being used as expected by a Redis client defined in our service (not the common JAR!) like this:

    @Inject
    @RedisClientName("second")
    RedisClient redisClient;

Should it be possible to have a bean class contained in a dependency JAR and make it use Redis connection defined in the project that uses that JAR?

Expected behavior Bean defined in a dependency JAR, which uses a Redis client annotated by @RedisClientName, properly using Redis connection defined in containing service.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
gleflochcommented, Mar 9, 2021

If this consists of looking in all archive classes and adding a test, I can take care or it 😃

1reaction
manovotncommented, Mar 9, 2021

I’d try with BeanArchiveIndexBuildItem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the Redis Client - Quarkus
This guide demonstrates how your Quarkus application can connect to a Redis server using the Redis Client extension. This technology is considered preview....
Read more >
Quarkus Redis client not using host from application.properties
The app however connects to my redis running on localhost, and everything works. By running it as a JAR, ./mvnw package java -jar...
Read more >
Spring Data Redis
The Spring Data Redis project applies core Spring concepts to the development of solutions by using a key-value style data store.
Read more >
Spring Boot Redis Cache - DigitalOcean
In this post, we will setup up a sample Spring boot application and integrate it with Redis Cache. While Redis is an Open...
Read more >
Troubleshoot connecting to an ElastiCache for Redis cluster
To automate the connection process, use the VPC Network Access Analyzer service to troubleshoot connectivity issues between AWS resources.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found