Use more specific bean method return types in KafkaAutoConfiguration

Update `KafkaAutoConfiguration` so that more specific bean types are
returned.

See gh-32770
pull/33276/head
yuanhao18 2 years ago committed by Phillip Webb
parent a92388cbee
commit c498ad0320

@ -74,14 +74,14 @@ public class KafkaAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean(ProducerListener.class)
public ProducerListener<Object, Object> kafkaProducerListener() {
@ConditionalOnMissingBean(LoggingProducerListener.class)
public LoggingProducerListener<Object, Object> kafkaProducerListener() {
return new LoggingProducerListener<>();
}
@Bean
@ConditionalOnMissingBean(ConsumerFactory.class)
public ConsumerFactory<?, ?> kafkaConsumerFactory(
@ConditionalOnMissingBean(DefaultKafkaConsumerFactory.class)
public DefaultKafkaConsumerFactory<?, ?> kafkaConsumerFactory(
ObjectProvider<DefaultKafkaConsumerFactoryCustomizer> customizers) {
DefaultKafkaConsumerFactory<Object, Object> factory = new DefaultKafkaConsumerFactory<>(
this.properties.buildConsumerProperties());
@ -90,8 +90,8 @@ public class KafkaAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean(ProducerFactory.class)
public ProducerFactory<?, ?> kafkaProducerFactory(
@ConditionalOnMissingBean(DefaultKafkaProducerFactory.class)
public DefaultKafkaProducerFactory<?, ?> kafkaProducerFactory(
ObjectProvider<DefaultKafkaProducerFactoryCustomizer> customizers) {
DefaultKafkaProducerFactory<?, ?> factory = new DefaultKafkaProducerFactory<>(
this.properties.buildProducerProperties());

Loading…
Cancel
Save