Best of BaeldungJuly 2024

  1. 1
    Article
    Avatar of baeldungBaeldung·2y

    Apache Kafka Tutorial Series

    This tutorial series covers essential topics about Apache Kafka, including its basics, how to integrate it with Spring Boot, configuring Kafka SSL, and setting up Kafka using Docker. It also explores Kafka consumer groups, retry mechanisms, and message ordering strategies, providing practical guidance for both newcomers and experienced developers.

  2. 2
    Article
    Avatar of baeldungBaeldung·2y

    Returning Errors Using ProblemDetail in Spring Boot

    Learn how to use ProblemDetail for standardized error responses in Spring Boot applications. Discover why it's important for API usability, how it streamlines error handling, and explore its implementation in both MVC and reactive applications. Includes setup, configuration, and global exception handling examples, complete with testing methods.

  3. 3
    Article
    Avatar of baeldungBaeldung·2y

    Java IDEs in 2024 – Survey Results

    A recent survey conducted between July 2 and July 10, 2024, revealed that IntelliJ (Community and Ultimate versions) remains the most popular Java IDE, followed by Eclipse. Visual Studio Code ranks third, outpacing NetBeans. The survey had 5788 respondents, some of whom selected multiple IDEs. The trend shows IntelliJ's user base growing while Eclipse's popularity declines compared to a similar survey from 2019.

  4. 4
    Article
    Avatar of baeldungBaeldung·2y

    Protobuf vs. gRPC

    Microservices architecture relies on efficient communication methods. Protobuf, a language-neutral mechanism for serializing structured data, offers compact and efficient data transfer but lacks human readability. gRPC, an open-source RPC framework built on HTTP/2 and using Protobuf for defining services, enables high-performance communication with features like streaming and multiplexing. While Protobuf excels in data serialization, gRPC provides a robust RPC framework suitable for real-time data exchange. The choice between them depends on specific needs, balancing efficiency, readability, and ease of configuration.

  5. 5
    Article
    Avatar of baeldungBaeldung·2y

    Checking if an Array Is Null or Empty in Java

    Learn how to check if an array is null or empty in Java, covering both object and primitive type arrays. This guide includes creating a generic method, handling primitive types, and using Apache Commons Lang's ArrayUtils and ObjectUtils utilities. Explore effective practices to write safer and more reliable Java code.

  6. 6
    Article
    Avatar of baeldungBaeldung·2y

    Sending WhatsApp Messages in Spring Boot Using Twilio

    Learn how to send WhatsApp messages using Twilio within a Spring Boot application. Discover the setup process for Twilio and WhatsApp Business Account (WABA), explore the necessary configurations, and implement functionality to send messages and handle user replies. The tutorial also covers sending templated notifications, creating webhook endpoints for handling replies, and testing the integration using MockServer.

  7. 7
    Article
    Avatar of baeldungBaeldung·2y

    Why the Order of Maven Dependencies Is Important

    Maven is a build and dependency management tool widely used in the Java ecosystem. Proper configuration of Maven dependencies is crucial to avoid compile-time and runtime issues. The post discusses key concepts such as POM, direct and transitive dependencies, and dependency mediation. It also explores practical examples, common errors, and tools like the Maven Dependency Plugin, Maven Enforcer Plugin, and Maven Help Plugin to manage and resolve dependency issues effectively.

  8. 8
    Article
    Avatar of baeldungBaeldung·2y

    How to Sort Map Value List by Element Field Using Java Streams

    Learn how to use Java's Stream API to sort a list of Employee objects stored within a Map, comparing it to the traditional List#sort(Comparator) method. The tutorial walks through reading employee data from a CSV file, storing it in a nested Map structure, and demonstrates sorting by salary and name using both methods. The Stream API offers improved readability, flexibility, and adherence to functional programming principles such as immutability and statelessness.

  9. 9
    Article
    Avatar of baeldungBaeldung·2y

    Getting the Insert ID in JDBC

    This tutorial demonstrates how to retrieve auto-generated primary keys immediately after inserting data into a database using JDBC. It explains the setup process with an H2 in-memory database, illustrates how to use PreparedStatement with RETURN_GENERATED_KEYS, and provides a unit test to verify the retrieval of insert IDs.

  10. 10
    Article
    Avatar of baeldungBaeldung·2y

    Intro to SpotBugs

    SpotBugs is an open-source static analysis tool designed to identify bugs in Java code by analyzing bytecode. It detects over 400 bug patterns, categorized by aspects such as type and severity. The post explains how to set up and use SpotBugs with Maven, generate and view reports, and fix detected bugs. It also covers how to integrate SpotBugs with IntelliJ IDEA and Eclipse, including installation, configuration, and browsing reports.

  11. 11
    Article
    Avatar of baeldungBaeldung·2y

    List All Files on the Remote Server in Java

    The post explains how to interact with remote servers in Java using JSch, Apache Mina SSHD, and SSHJ libraries. It covers establishing a secure connection with a private key, opening an SFTP channel, and listing files in a remote directory. Detailed steps and code examples for each library are provided, including configuring dependencies, creating sessions, and retrieving file details.

  12. 12
    Article
    Avatar of baeldungBaeldung·2y

    Introduction to Milvus

    Milvus is a scalable open-source vector database designed for storing and indexing vector embeddings from AI models. This guide focuses on the integration and management of Milvus using its Java client SDK, covering CRUD operations, administrative tasks, and performing vector similarity searches. The tutorial includes setting up a Milvus DB instance, creating collections, partitions, inserting data, and deleting records, providing sample code for each operation.

  13. 13
    Article
    Avatar of baeldungBaeldung·2y

    Difference Between M2_HOME, MAVEN_HOME and using the PATH variable

    The post explores the differences between the M2_HOME, MAVEN_HOME, and PATH environment variables as part of the Apache Maven installation. It details how each variable is used depending on the Maven version and explains how to configure these variables for a smooth installation process. The tutorial covers Maven versions 1.x, 2.x, and 3.x, highlighting the changes in environment variable requirements for each version.

  14. 14
    Article
    Avatar of baeldungBaeldung·2y

    Validation Using the Spring Validator Interface

    Learn how to use the Spring Validator interface to validate objects in a Spring-based application. Key methods include supports(), which checks if a validator can handle a specific class, and validate(), which enforces custom validation logic. Detailed examples include implementing a custom UserValidator, configuring it as a Spring bean, and using it within a Spring MVC controller for validating user data in REST API endpoints.

  15. 15
    Article
    Avatar of baeldungBaeldung·2y

    Spring Security 6.3 – What’s New

    Spring Security 6.3 introduces several key enhancements, including passive JDK serialization support to address issues related to serialization across versions, new authorization features like defining meta-annotations for role management, and the ability to secure return values with the @AuthorizeReturnObject annotation. Additionally, the update includes error handling improvements and compromised password checks using Pwned Passwords API. The update also adds support for OAuth 2.0 Token Exchange, enabling clients to exchange tokens while retaining user identity.

  16. 16
    Article
    Avatar of baeldungBaeldung·2y

    Maven Spotless Plugin for Java

    Learn to use the Maven Spotless Plugin for Java projects to enforce consistent code style. The tutorial covers minimal configuration with Google Java Style, customizing formatting rules using an Eclipse Formatter Profile, and adding additional static analysis steps. It also explains how to bind Spotless goals to specific Maven phases to ensure consistent code style checks during the build process.

  17. 17
    Article
    Avatar of baeldungBaeldung·2y

    Function Calling in Java and Spring AI Using the Mistral AI API

    The post discusses how to use function calling to integrate large language models (LLMs) with internal logic, focusing on the Mistral AI API. It includes detailed steps on retrieving an API key, making a basic API request, and more advanced usage with Spring Boot for easier setup. Examples demonstrate how to retrieve and use patient health statuses via the Mistral API, illustrating both single and multiple function calls.