Java libraries I like
comments
The list was updated in 2024.
Everyone knows Spring and Hibernate, but there are other libraries and frameworks that are worth your attention. I pulled a list of 42 Java libraries that I like and use daily. Some of them are well-known; others are not so popular, yet very useful at work.
Name | About |
---|---|
ArchUnit | A simple and extensible library for checking the architecture of your Java code via tests. |
AssertJ | A library for writing fluent and rich assertions in Java tests. |
Awaitility | A DSL that allows you to express expectations of an asynchronous system in a concise and easy to read manner. |
ByteBuddy | A library for creating and modifying Java classes during the runtime. |
Caffeine | A high performance, near optimal caching library based on Java 8 and a faster replacement of Guava Cache. |
Dagger | A compile-time dependency injection library with low or zero runtime overload. Works well with Google's Auto Factory. |
EA Async | EA Async adds async awaits to in the JVM and allows programmers to write asynchronous code in a sequential fashion. |
Failsafe | A lightweight, zero-dependency library for handling failures in Java 8+, with a concise API for handling everyday use cases and the flexibility to handle everything else. |
Faker | A library for generating fake data, useful when you're developing a new project and need some pretty data for showcase. |
Flyway | Evolve your database schema easily and reliably across all your instances. |
Google Auto Service | A library for automatic generation of java.utils.ServiceLocator META-INF metadata for any class annotated with @AutoService, avoiding typos, providing resistance to errors from refactoring. |
Guava | A set of common libraries for Java, developed and maintained by Google. |
Guava Testlib | A set of testing utilities for collections, equals(), hashCode(), toString() etc. |
Hashids | Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers. Useful if you want to obfuscate and expose (non-critical) numbers via API. |
Immutables | Immutables generates simple, safe, and consistent value objects (data classes). It's more flexible than Google's AutoValue and Lombok. |
Javalin | A simple web framework for Java and Kotlin. My favorite alternative to Spring MVC. |
Jimfs | An in-memory file system for Java, super useful for unit testing, because you don't want to mock the file system. |
JobRunr | An extremely easy way to perform background processing in Java. Backed by persistent storage.. |
jOOQ | A fluent API for typesafe SQL query construction and execution. My favorite alternative to Hibernate. |
jOOR | A simple, intuitive, and fluent wrapper over Java Reflection API. |
Logbook | An extensible Java library to enable complete request and response logging for different client- and server-side technologies. |
LogCaptor | LogCaptor captures log entries for unit and integration testing purposes.. |
Mug | A small Java 8 utilities library that complements Guava. Has useful classes such as Maybe. |
NoException | A library for dealing with checked exceptions in lambdas. Supports sneaky throws. |
NullAway | A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead. |
Parallel Collectors | A toolkit simplifying parallel collection processing in Java using Stream API.. |
PipelinR | a lightweight command processing pipeline ❍ ⇢ ❍ ⇢ ❍ for your Java awesome app. (I am an author). |
Problem | A library that implements and proposes a common approach for expressing errors in REST API. |
Protonpack | A small collection of Stream utilities, such as Streamable interface (useful when you want to stream repeatedly). |
RestAssured | A DSL for writing powerful, maintainable tests for RESTful APIs. |
Retrofit | A type-safe HTTP client for Android and Java. |
Selenide | Concise UI tests in Java. |
Spock | Spock is a testing and specification framework written in Groovy. Probably the best way to write tests in Java. |
Stateless4j | A library for creating state machines and lightweight state machine-based workflows directly in Java code. |
StreamEx | StreamEx simplifies and enhances Java Stream API. |
TestContainers | A library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. |
ThreeTen Extra | Additional date-time classes that complement those in Java 8. (MutableClock, LocalDateRange etc.). |
Throwing Function | Checked Exceptions-enabled Java 8+ functional interfaces + adapters. |
Verbal Expressions | A library that helps to construct difficult regular expressions. |
WireMock | A flexible API mocking tool for fast, robust and comprehensive testing. |
Xembly | An imperative language for modifying XML documents. |
Yavi | A lambda based type-safe validation library. |