JLite is a comprehensive Java library suite providing utility functions, Spring Boot extensions, and modular components to accelerate application development. Built with modern Java practices, JLite offers a collection of battle-tested utilities and abstractions for common development tasks.
- Features
- Modules
- Installation
- Quick Start
- Building from Source
- Requirements
- Documentation
- Contributing
- License
- 🛠️ Utility Functions - String manipulation, date/time operations, validation, and more
- 🏗️ Spring Boot Abstractions - Service layer patterns, repository specifications, and pagination
- 📧 Email Support - Simple API for sending emails with attachments and HTML content
- 📊 CSV Processing - Read and write CSV files with nested objects and collections
- ☁️ AWS Integration - Simplified AWS credentials configuration
- 🔄 JSON Utilities - Custom deserializers and JSON processing helpers
- 📝 Type-Safe Builders - Fluent APIs across all modules
- ✅ Well-Tested - Comprehensive test coverage
Core modules provide fundamental utilities and abstractions that can be used in any Java application.
General-purpose utility library with common functions for everyday development tasks.
Key Features:
- String manipulation (
Strings,Regex) - Date and time utilities (
Dates,LocalDates,DateRange) - Validation helpers (
Assert,Is) - Number operations (
Numbers) - JSON processing (
JSON) - Logging utilities (
LogBuilder) - Unique ID generation (
UniqueIdGenerator)
Usage:
implementation 'com.javaquery:util:1.0.0'Example:
// String utilitiesStringresult = Strings.nullOrEmpty(input, "default");
booleanisEmpty = Strings.nullOrEmpty(str);
// Date utilitiesDatedate = Dates.parse("2025-12-19", DatePattern.YYYY_MM_DD);
Stringformatted = Dates.format(newDate(), DatePattern.YYYY_MM_DD);
// ValidationAssert.notNull(object, "Object must not be null");
booleanisValid = Is.email("test@example.com");Spring Boot utilities providing common patterns for service layers, repositories, and data handling.
Key Features:
- Abstract service implementation with CRUD operations
- JPA Specification builders for dynamic queries
- Pagination support with
PageData - Custom JSON deserializers for
LocalDateTimeandString - Built-in event publishing support
Usage:
implementation 'com.javaquery:spring:1.0.0'Example:
@ServicepublicclassCustomerServiceextendsAbstractService<Customer, Long> {
publicCustomerService(CustomerRepositoryrepository, ApplicationEventPublishereventPublisher) {
super(repository, eventPublisher);
}
}
// Use built-in methodsCustomercustomer = customerService.findById(1L, () -> newNotFoundException("Not found"));
PageData<Customer> page = customerService.findAll(Pageable.of(0, 20));HTTP client utilities (under development).
FTP client utilities (under development).
Extension modules provide specialized functionality for specific use cases.
Enhanced CSV processing library built on OpenCSV with support for batch processing, nested objects, and collections.
Key Features:
- Fluent builder API for reading and writing CSV files
- Batch processing for memory-efficient handling of large files
- Nested object support using dot notation
- Collection (List/Set) handling
- Annotation-based field mapping with
@Exportable - Custom row transformation
Usage:
implementation 'com.javaquery:ext-opencsv:1.0.0'Example:
// Writing CSVCsvWriter.<Customer>builder()
.headers(List.of("First Name", "Last Name", "Email"))
.keys(List.of("firstName", "lastName", "email"))
.data(customers)
.toFile(newFile("customers.csv"))
.write();
// Reading CSVCsvReader.<Customer>builder()
.source(newFile("customers.csv"))
.rowTransformer((headers, values, prevRow) -> newCustomer(values[0], values[1], values[2]))
.batchProcessor(batch -> repository.saveAll(batch))
.batchSize(1000)
.read();Lightweight Spring Boot email module with a clean API for sending emails.
Key Features:
- Builder pattern for email composition
- HTML and plain text support
- Multiple attachments
- TO, CC, BCC recipients
- Reply-to configuration
- Enable/disable via configuration
Usage:
implementation 'com.javaquery:spring-email:1.0.0'
implementation 'org.springframework.boot:spring-boot-starter-mail'Example:
@AutowiredprivateEmailServiceemailService;
emailService.builder()
.to("user@example.com")
.subject("Welcome!")
.htmlBody("<h1>Welcome to our service</h1>")
.attachment(newFile("document.pdf"))
.send();AWS integration utilities for Spring Boot applications.
Key Features:
- Automatic AWS credentials provider configuration
- Support for static credentials or default credentials chain
- Spring Boot auto-configuration
Usage:
implementation 'com.javaquery:spring-aws:1.0.0'Configuration:
aws:
accessKeyId: ${AWS_ACCESS_KEY_ID}secretAccessKey: ${AWS_SECRET_ACCESS_KEY}providerName: MyProvideraccountId: 123456789012Add the JLite modules you need to your build.gradle:
dependencies {
// Core utilities
implementation 'com.javaquery:util:1.0.0'// Spring utilities
implementation 'com.javaquery:spring:1.0.0'// CSV processing
implementation 'com.javaquery:ext-opencsv:1.0.0'// Email support
implementation 'com.javaquery:spring-email:1.0.0'// AWS integration
implementation 'com.javaquery:spring-aws:1.0.0'
}Add the JLite modules to your pom.xml:
<dependencies>
<!-- Core utilities -->
<dependency>
<groupId>com.javaquery</groupId>
<artifactId>util</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Spring utilities -->
<dependency>
<groupId>com.javaquery</groupId>
<artifactId>spring</artifactId>
<version>1.0.0</version>
</dependency>
<!-- CSV processing -->
<dependency>
<groupId>com.javaquery</groupId>
<artifactId>ext-opencsv</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Email support -->
<dependency>
<groupId>com.javaquery</groupId>
<artifactId>spring-email</artifactId>
<version>1.0.0</version>
</dependency>
<!-- AWS integration -->
<dependency>
<groupId>com.javaquery</groupId>
<artifactId>spring-aws</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>// 1. Define your entity@EntitypublicclassCustomer {
@Id@GeneratedValueprivateLongid;
privateStringfirstName;
privateStringlastName;
privateStringemail;
// getters and setters
}
// 2. Create repository with specificationspublicinterfaceCustomerRepositoryextendsJpaRepository<Customer, Long>,
JpaSpecificationExecutor<Customer>,
AbstractSpecification<Customer> {
}
// 3. Create service extending AbstractService@ServicepublicclassCustomerServiceImplextendsAbstractService<Customer, Long> implementsCustomerService {
publicCustomerServiceImpl(CustomerRepositoryrepository, ApplicationEventPublishereventPublisher) {
super(repository, eventPublisher);
}
publicList<Customer> findActiveGmailCustomers() {
Specification<Customer> spec = Specification
.where(((CustomerRepository) repository).equal("status", "ACTIVE"))
.and(((CustomerRepository) repository).endsWith("email", "@gmail.com"));
returnfindAll(spec);
}
}
// 4. Use in controller@RestController@RequestMapping("/customers")
publicclassCustomerController {
@AutowiredprivateCustomerServicecustomerService;
@AutowiredprivateEmailServiceemailService;
@GetMappingpublicPageData<Customer> getCustomers(Pageablepageable) {
returncustomerService.findAll(pageable);
}
@PostMappingpublicCustomercreateCustomer(@RequestBodyCustomercustomer) {
Customersaved = customerService.save(customer);
// Send welcome emailemailService.builder()
.to(customer.getEmail())
.subject("Welcome!")
.htmlBody("<h1>Welcome " + customer.getFirstName() + "!</h1>")
.send();
returnsaved;
}
@PostMapping("/export")
publicvoidexportToCSV(HttpServletResponseresponse) {
List<Customer> customers = customerService.findAll(
Specification.where(null), Pageable.unpaged()).getData();
CsvWriter.<Customer>builder()
.headers(List.of("First Name", "Last Name", "Email"))
.keys(List.of("firstName", "lastName", "email"))
.data(customers)
.toOutputStream(response.getOutputStream())
.write();
}
}Clone the repository and build using Gradle:
git clone https://github.com/javaquery/JLite.git
cd JLite
./gradlew build# Build core:util
./gradlew :core:util:build
# Build core:spring
./gradlew :core:spring:build
# Build module:ext-opencsv
./gradlew :module:ext-opencsv:build# Run all tests
./gradlew test# Run tests for specific module
./gradlew :core:spring:test- Java: 11 or higher
- Spring Boot: 2.7.18 (for Spring modules)
- Gradle: 7.x or higher (for building from source)
Each module has its own detailed documentation:
- core:util - Utility functions
- core:spring - Spring Boot utilities
- module:ext-opencsv - CSV processing
- module:spring-email - Email support
- module:spring-aws - AWS integration
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- All tests pass
- Code follows existing style conventions
- New features include tests
- Documentation is updated
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
javaquery - GitHub Profile
- Built with Spring Boot
- CSV processing powered by OpenCSV
- AWS integration using AWS SDK for Java 2.x
- 🐛 Report Issues
- 💬 Discussions
- 📧 Contact: vicky.thakor@javaquery.com
Made with ❤️ by javaquery