liveBook · Manning

Application context

As explained in Kafka Streams in Action, Second Edition

A Spring application context is a container-managed registry of application objects and their configuration.

A Spring application context is the container-managed registry that configures application components and makes them available for dependency injection. SpringApplicationBuilder.run creates it while starting a Spring Boot application. section 12.2

The context coordinates the main parts of a Kafka-enabled application:

  • Scans configured base packages and registers classes annotated with @Component. section 12.2 section 12.2.1
  • Injects dependencies such as KafkaTemplate into registered components through constructor or field autowiring. section 12.2.1
  • Creates Kafka listener infrastructure for methods annotated with @KafkaListener, connecting them to Kafka consumers. section 12.2.1
  • Starts without an embedded web server when WebApplicationType.NONE is selected for a non-web streaming application. section 12.2

Loan application processing

A Spring Boot main class builds the context, scans application packages, and starts the non-web application. The context discovers NewLoanApplicationProcessor, supplies its KafkaTemplate, and turns its listener method into a Kafka-consuming endpoint. That processor sends approved, rejected, and quality-assurance loan applications to separate topics.

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains creation, scanning, injection, and listener wrapping, but stops short of container internals.
Examples
Uses a loan-processing application with annotated processors, injected KafkaTemplate, and approval, rejection, and quality-assurance topics.
What it assumes
Assumes familiarity with Java classes and annotations while demonstrating Spring Boot startup and component wiring.
What you can do after
Operate/configure a Spring Kafka application by starting its context and wiring annotated components and listeners.
How it connects
Connects Spring Boot, Spring container, dependency injection, KafkaTemplate, Kafka listeners, and Kafka consumers.

Also explained in

Compare how 2 books explain application context →

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.