|
| 1 | +--- |
| 2 | +slug: 2025-12-28-problem4j-project-launch |
| 3 | +title: Problem4J Project Launch |
| 4 | +authors: malczuuu |
| 5 | +tags: [hello, release] |
| 6 | +--- |
| 7 | + |
| 8 | +Hi everyone 👋 |
| 9 | + |
| 10 | +Allow me to introduce Problem4J to y'all. It's another set of Java libraries implementing **RFC7807 - Problem Details |
| 11 | +for HTTP APIs**. |
| 12 | + |
| 13 | +Problem4J is a package of libraries that introduces RFC Problem Details to the Java ecosystem. It combines an |
| 14 | +imperative approach, based on extending a common exception type (`ProblemException`), with a declarative, |
| 15 | +annotation-based approach (via `@ProblemMapping`). As a primary set of modules, `problem4j-core`, `problem4j-jackson`, |
| 16 | +and `problem4j-spring` were introduced, providing a core (framework-agnostic) module, Jackson integration (both v2 - |
| 17 | +`com.fasterxml.jackson` and v3 - `tools.jackson`), as well as Spring Boot integration (supporting both leading versions |
| 18 | +\- v3 and v4). Other integrations may (or may not) eventually arrive. |
| 19 | + |
| 20 | +<!-- truncate --> |
| 21 | + |
| 22 | +**Why should I care?** |
| 23 | + |
| 24 | +If you are building HTTP APIs in Java, Problem4J aims to reduce the boilerplate around error handling while keeping |
| 25 | +your domain logic clean and explicit. By clearly separating the `Problem` representation from exceptions, and by |
| 26 | +offering both imperative and declarative mapping options, the library helps you produce consistent, standards-compliant |
| 27 | +error responses without tightly coupling your code to a specific framework. This becomes especially useful in high-end |
| 28 | +framework applications (such as Spring Boot), where sensible defaults and simple extension points can significantly |
| 29 | +improve both developer experience and maintainability. |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +The following modules and versions are considered the first public releases of this library. Previous versions were |
| 34 | +developed as a "personal playground" under the `io.github.malczuuu.problem4j` group namespace. |
| 35 | + |
| 36 | +* Core |
| 37 | + * `io.github.problem4j:problem4j-core:1.3.0` |
| 38 | +* Jackson Integration |
| 39 | + * `io.github.problem4j:problem4j-jackson2:1.3.0` (Jackson 2 - `com.fasterxml.jackson`) |
| 40 | + * `io.github.problem4j:problem4j-jackson3:1.3.0` (Jackson 3 - `tools.jackson`) |
| 41 | +* Spring Boot 3.x Integration |
| 42 | + * `io.github.problem4j:problem4j-spring-bom:1.2.0` |
| 43 | + * `io.github.problem4j:problem4j-spring-web:1.2.0` |
| 44 | + * `io.github.problem4j:problem4j-spring-webflux:1.2.0` |
| 45 | + * `io.github.problem4j:problem4j-spring-webmvc:1.2.0` |
| 46 | +* Spring Boot 4.x Integration |
| 47 | + * `io.github.problem4j:problem4j-spring-bom:2.1.0` |
| 48 | + * `io.github.problem4j:problem4j-spring-web:2.1.0` |
| 49 | + * `io.github.problem4j:problem4j-spring-webflux:2.1.0` |
| 50 | + * `io.github.problem4j:problem4j-spring-webmvc:2.1.0` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +The main inspiration was the idea of taking a slightly different approach than [`zalando/problem`][zalando-problem], as |
| 55 | +well as the fact that [`zalando/problem-spring-web`][zalando-problem-spring-web] does not seem to have received an |
| 56 | +update for Spring Boot 4 at the time of writing this post. What differentiates this library from Zalando's is the |
| 57 | +separation of the `Problem` model from the throwable `ProblemException`, including a declarative approach with |
| 58 | +`@ProblemMapping` annotation, as well as making Spring Boot's predefined exception handlers more beginner-friendly |
| 59 | +(simple `ProblemResolver` implementations declared as `@Component`s). Moreover, predefined Spring Boot error messages |
| 60 | +tend to hide exception internals and do not expose plain exception messages in HTTP responses. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +Feedback, ideas, and contributions are very welcome 🚀 |
| 65 | + |
| 66 | +**References** |
| 67 | + |
| 68 | +* [RFC7807 - Problem Details for HTTP APIs][rfc7807] |
| 69 | +* [RFC9457 - Problem Details for HTTP APIs][rfc9457] |
| 70 | + |
| 71 | +[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807 |
| 72 | + |
| 73 | +[rfc9457]: https://datatracker.ietf.org/doc/html/rfc9457 |
| 74 | + |
| 75 | +[zalando-problem]: https://github.com/zalando/problem |
| 76 | + |
| 77 | +[zalando-problem-spring-web]: https://github.com/zalando/problem-spring-web |
0 commit comments