Skip to content

Commit

Permalink
feat(kafka): update kafka example to use a bean configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
timonback committed Nov 29, 2023
1 parent 5b40196 commit 1b57bf6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.example.kafka.configuration;

import io.github.stavshamir.springwolf.example.kafka.producers.NestedProducer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class NestedProducerBeanConfiguration {

/**
* Define Producer via spring bean.
* Annotations present on that class should also be found
*/
@Bean
public NestedProducer nestedProducer() {
return new NestedProducer();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import static org.springframework.kafka.support.mapping.AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME;

@Component
public class NestedProducer {

@Autowired
Expand Down

0 comments on commit 1b57bf6

Please sign in to comment.