Skip to content

Commit

Permalink
Use more specific bean method return types in KafkaAutoConfiguration
Browse files Browse the repository at this point in the history
Update `KafkaAutoConfiguration` so that more specific bean types are
returned.

See gh-32770
  • Loading branch information
yuanhao18 authored and philwebb committed Oct 18, 2022
1 parent a92388c commit c498ad0
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -74,14 +74,14 @@ public KafkaAutoConfiguration(KafkaProperties properties) {
}

@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());
Expand All @@ -90,8 +90,8 @@ public ProducerListener<Object, Object> kafkaProducerListener() {
}

@Bean
@ConditionalOnMissingBean(ProducerFactory.class)
public ProducerFactory<?, ?> kafkaProducerFactory(
@ConditionalOnMissingBean(DefaultKafkaProducerFactory.class)
public DefaultKafkaProducerFactory<?, ?> kafkaProducerFactory(
ObjectProvider<DefaultKafkaProducerFactoryCustomizer> customizers) {
DefaultKafkaProducerFactory<?, ?> factory = new DefaultKafkaProducerFactory<>(
this.properties.buildProducerProperties());
Expand Down

0 comments on commit c498ad0

Please sign in to comment.