What is the role of the KafkaTemplate class in Spring?
KafkaTemplate is Spring's template for producing Kafka messages. See manual configuration, keyed JSON sends, reliability settings and embedded tests.
2,886 posts about Java: questions with answers, tutorials and articles, newest first.
KafkaTemplate is Spring's template for producing Kafka messages. See manual configuration, keyed JSON sends, reliability settings and embedded tests.
Set up a Spring Boot Kafka producer with spring-kafka: properties, serializers, KafkaTemplate and CompletableFuture callbacks, topic creation and reliability settings.
Use Kafka for event messaging in Spring Boot: design topics and keys, publish with KafkaTemplate, consume in groups and pick delivery guarantees.
Spring Data MongoDB's Aggregation class builds typed pipelines with match, group, sort and lookup stages. See working examples with MongoTemplate.
Build MongoDB aggregation pipelines in Spring Data with Aggregation.newAggregation and MongoTemplate, from group and sort stages to typed results and repository annotations.
Pageable becomes skip, limit and sort in a MongoDB query. See repository and MongoTemplate paging, count queries and keyset scrolling.
Structured logging writes log events as named fields, usually JSON, so you can correlate and query them across services. See a schema, Java examples and practices.
Use SLF4J, structured JSON on standard output, deliberate log levels and correlation ids so production logs stay searchable, cheap and free of secrets.
Use SLF4J, structured JSON on standard output, deliberate log levels and correlation ids so production logs stay searchable, cheap and free of secrets.
Page and sort MongoDB documents in Spring Boot with MongoRepository, Pageable and MongoTemplate, and keep large collections fast with indexes.
Logback is the SLF4J-native default in Spring Boot, while Log4j 2 excels at async logging. Compare features, config and performance, then choose.
MongoTemplate wraps the MongoDB driver with typed insert, find, update and remove methods. Learn how to use Query, Criteria and Update, and when it beats a repository.
MongoDB relationships use embedded documents or references. Learn when to choose each, with Spring Data MongoDB, @DocumentReference and $lookup.
Set up a custom Java logger with java.util.logging or SLF4J and Logback, including file rotation, formatting, MDC and production logging practices.
@Document maps a Java class to a MongoDB collection in Spring Data MongoDB. See how to name collections, use records, add indexes and avoid common mistakes.
logback.xml defines where Spring Boot logs go, how they look and which levels apply. See a rolling file setup and why logback-spring.xml is usually better.
Extend MongoRepository for a @Document class, then use derived query methods, @Query, paging and MongoTemplate. Covers setup with and without Spring Boot.
Configure Spring Boot log levels with logging.level properties, groups and profiles, then change them at runtime through Actuator or LoggingSystem.
It provides the MongoDB driver, Spring Data repositories and an auto-configured MongoTemplate for Spring Boot applications.
Lombok's @Slf4j adds a static final SLF4J logger named log to your class at compile time. See how it works, how to configure it and which alternatives exist.