Named Redis client injection not working when used in separate JAR
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:8 (6 by maintainers)
If this consists of looking in all archive classes and adding a test, I can take care or it 😃
I’d try with BeanArchiveIndexBuildItem.