liveBook · Manning

Component decorator

As explained in Kafka Streams in Action, Second Edition

@Component is a Spring annotation marking a class for automatic detection and registration as a managed component.

@Component marks a Java class for automatic detection and registration in the Spring application context. During startup, the Spring container scans annotated classes, manages their lifecycle, injects dependencies into them, and makes them available to other components. section 12.2.1

Loan application processor

Annotate NewLoanApplicationProcessor with @Component, then inject KafkaTemplate through its @Autowired constructor. Spring creates the processor and supplies the KafkaTemplate used to publish approved, rejected, and quality-assurance loan events. section 12.2.1

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains scanning, registration, dependency injection, and constructor use, but does not detail component-scan configuration or lifecycle internals.
Examples
Uses loan processors that publish approved, rejected, and quality-assurance records through KafkaTemplate.
What it assumes
Assumes Java classes and Spring annotations, while demonstrating container scanning and dependency injection through a concrete processor.
What you can do after
Operate/configure Spring-managed Kafka processors by annotating classes and injecting required constructor dependencies.
How it connects
Connects component registration with the Spring container, application context, dependency injection, KafkaTemplate, and KafkaListener.

Also explained in

Compare how 3 books explain component decorator →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.