Open chirdeeptomar opened 4 years ago
/cc @geoand
Quarkus Spring DI support merely transforms Spring annotations into CDI annotations, here it's more about providing an alternative implementation of Spring DI itself, which can be tedious if you one want to fill all the gaps.
Maybe you have to consider switching to CDI for some part of your code, i.e: mixing CDI and SpringDI code ?
Same issue if the original Spring application code uses ObjectFactory
:
@Configuration
public class KafkaConfig {
@Bean
public Producer<String, Message> createProducer() { /* Config stuff */}
}
And in my @Service class:
@Service
public class MessageService {
private ObjectFactory<Producer<String, Message>> producer;
public MessageService(ObjectFactory<Producer<String, Message>> producer) {
this.producer = producer;
}
}
Error stack trace:
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.springframework.beans.factory.ObjectFactory<org.apache.kafka.clients.producer.Producer<java.lang.String, com.rmarting.kafka.schema.avro.Message>> and qualifiers [@Default]
- java member: com.rmarting.kafka.service.MessageService#<init>()
- declared on CLASS bean [types=[com.rmarting.kafka.service.MessageService, java.lang.Object], qualifiers=[@Named(value = "messageService"), @Default, @Any], target=com.rmarting.kafka.service.MessageService]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:504)
In both cases, should we refactor these definitions using CDI instead of Spring DI? Is there any plan to cover these Spring feature?
Hi,
We could most likely offer support for this. If enough people ask, we'll put the effort into it :)
Description
I have the following Spring bean that use ObjectProvider in one of the gradle modules, I have Quarkus as the web layer. Quarkus is unable to resolve ObjectProvider dependency. I have set up beans.xml, everything works until I add the AppConfig as below.
CustomerBuilder.java
Quarkus Graphql module
Error
`Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.springframework.beans.factory.ObjectProvider<com.exa mple.demo.CustomerBuilder> and qualifiers [@Default]