Tag: Java
How to use Kafka with Quarkus?
Natan Ferreira- 0
- 805
Apache Kafka is one of the most popular solutions for large-scale distributed event streaming. Its ability to handle high volumes of messages makes it ideal for event-driven architectures. In this post, you’ll learn how to use Kafka with Quarkus, a modern framework for cloud-native Java applications. Best of all: Quarkus’ Kafka support also works with…
Read More
What are Checked vs Unchecked Exceptions in Java?
Natan Ferreira- 0
- 803
In Java, exceptions are part of the Throwable hierarchy and are used to signal abnormal situations during the execution of a program. Understanding how exceptions are structured helps in designing more robust and readable code. At the top of the hierarchy is the Throwable class, which has two direct subclasses: Checked Exceptions Checked exceptions are…
Read More
How to paginate using Spring Data JPA?
Natan Ferreira- 0
- 965
Spring Data JPA enables pagination through the JpaRepository interface, which extends PagingAndSortingRepository — an interface that provides pagination support. Let’s go over more details with a practical example. If you need to understand how Spring Data JPA works, there are more articles on the blog explaining that: Hands on You’ll need some of the following…
Read More
What’s the difference between Concurrency and Parallelism?
Natan Ferreira- 0
- 307
Concurrency and Parallelism are important concepts for bringing more efficiency to software, but they do not mean the same thing. A software application can handle multiple tasks, and the way these tasks are processed differs in each concept. Concurrency Imagine the scenario where we have a software that needs to process multiple tasks, such as…
Read More
How to create a custom repository in Spring Data JPA?
Natan Ferreira- 0
- 1031
Spring Data JPA is great for abstracting away boilerplate code when accessing the database. It allows us to create query methods by simply defining method signatures. But sometimes, we need more complex or dynamic queries — and that’s where custom repositories come into play. In this post, I’ll show how to create a custom repository…
Read More
What is Spring Data JPA?
Natan Ferreira- 0
- 698
Spring Data JPA is a module of Spring Data that simplifies the implementation of repositories. It provides an automatic way to create repository implementations based on Java interfaces, eliminating the need to manually write the repository implementation. To make this work, you need to create an interface using the @Repository annotation and extend JpaRepository. The…
Read More
How to avoid NullPointerException in Java using Optional?
Natan Ferreira- 0
- 625
Optional was introduced in Java 8 as a way to handle potentially null values more safely and expressively. It helps to avoid NullPointerException and makes the code more readable. Hands on Creating an Optional Optional can be created in several ways: Printing the results will show the following output. Checking for Value Presence Optional provides…
Read More
What is algorithm complexity?
Natan Ferreira- 0
- 480
Algorithm complexity is a fundamental concept in computer science, used to measure the efficiency of an algorithm in terms of execution time and memory usage. By analyzing complexity, we can predict how an algorithm behaves as the input size increases, allowing us to choose more appropriate solutions for different problems. How do we measure it?…
Read More
How do @PostConstruct and @PreDestroy annotation work in java?
Natan Ferreira- 0
- 1083
Methods annotated with @PostConstruct and @PreDestroy are commonly used in the lifecycle of beans managed by the container, such as in frameworks like Spring or Quarkus. An example of their use is opening and closing database connections. If you want to know more about Bean management in Spring, don’t hesitate to read this post. @PostConstruct…
Read More
How do functional interfaces work in Java?
Natan Ferreira- 0
- 616
Functional Interfaces are a fundamental concept in functional programming introduced in Java 8. They are interfaces that have exactly one abstract method, allowing the use of lambda expressions and method references to make the code more concise and readable. They can be used in Streams, for example, and promote code reuse. We can find several…
Read More