It's official: Sanitizer-Lib is now available on Maven Central! π
A few months ago, I introduced Sanitizer-Lib, a Java library designed to kill the boilerplate of input sanitization. No more manual .trim() calls, no more scattered string manipulation logic. Just clean, declarative annotations.
Since then, the feedback has been amazing. But there was one friction point: you had to use JitPack or build it locally.
Not anymore.
As of today, you can pull Sanitizer-Lib directly from Maven Central. It's production-ready, signed, and just a copy-paste away.
How do you add Sanitizer-Lib to your Maven or Gradle project?
Maven
Add this to your pom.xml:
<dependency>
<groupId>io.github.rabinarayanpatra.sanitizer</groupId>
<artifactId>sanitizer-spring</artifactId>
<version>1.0.22</version>
</dependency>Gradle
Add this to your build.gradle:
implementation("io.github.rabinarayanpatra:sanitizer-spring:1.0.22")What problems does Sanitizer-Lib solve that manual validation doesn't?
If you missed the original deep dive, here is the 30-second pitch:
Instead of writing this validation spaghetti:
public void createUser(UserDto user) {
if (user.getEmail() != null) {
user.setEmail(user.getEmail().trim().toLowerCase());
}
// ... repeat for 10 other fields
}You just do this:
public class UserDto {
@Sanitize(using = {TrimSanitizer.class, LowerCaseSanitizer.class})
private String email;
}That's it. Incoming requests are automatically sanitized before they even hit your controller logic.
What changed from JitPack to Maven Central?
Publishing to Maven Central means:
- No extra repository configuration β Maven Central is the default repository for every Maven and Gradle project
- Signed artifacts β All JARs are GPG-signed, ensuring you're getting the authentic library
- Reliable availability β Maven Central has 99.99% uptime, unlike JitPack which can have intermittent issues
- Better IDE support β IntelliJ and Eclipse resolve Maven Central dependencies faster
Migration from JitPack
If you were using Sanitizer-Lib via JitPack, here's what to change:
- Remove the JitPack repository from your
pom.xmlorbuild.gradle - Update the group ID from
com.github.rabinarayanpatratoio.github.rabinarayanpatra.sanitizer - Update to the latest version (
1.0.22)
The API remains 100% backward compatible β no code changes required.
Where can you learn more about Sanitizer-Lib?
For a full walkthrough of features, custom sanitizers, and Spring Boot integration, check out my detailed guide:
Read the Full Sanitizer-Lib Introduction
Or star the repo on GitHub: github.com/rabinarayanpatra/sanitizer-lib
For more information, see the Maven Central Repository Search and the Sonatype OSSRH Publishing Guide.
Keep Reading
- Sanitizer-Lib: The Full Introduction β A complete walkthrough of all features, custom sanitizers, and Spring Boot integration.
- 10 Essential Java Libraries Beyond Lombok β More libraries that cut boilerplate and improve code quality alongside Sanitizer-Lib.
Happy coding!
