Introducing Kafka to Spring Boot
Until now, in our previous chapters, we have used the official libraries and APIs provided by Apache Kafka. We integrated those libraries in plain old Java and defined our use-cases. Going forward in all our upcoming chapters, we will be using Spring Boot and adding the relevant libraries to integrate Kafka.
Introducing Spring Boot
Spring Boot is an open-source framework developed and maintained by a company called Pivotal. It provides a platform for Java developers to create stand-alone, auto-configurable, production-grade Spring applications where we can focus on our business implementation rather than low-level logic. Spring Boot is also opinionated, as it determines the default values for our configuration. It takes care of the underlying packages and libraries to install for the features or dependencies we require.
Spring Boot is designed to achieve the following goals:
- To host and develop production-grade code easily.
- To reduce development time and run the application independently of infrastructure and framework.
- To avoid complex XML configurations provided by Spring.
- To provide a flexible way to define Java beans and database transactions.
- To offer powerful batch processing and manage REST APIs.
- To ease dependency management and include an Embedded Servlet Container.
With that said, let's quickly jump into our development and start defining our dependencies to publish and consume Kafka messages.