A banking API implemented with MicroProfile, powered with Quarkus, demonstrating Java 21+ features. The application provides account management and transaction processing capabilities with a focus on simplicity, observability, and testability.
The application follows the Boundary-Control-Entity (BCE/ECB) pattern pattern to maintain clear separation of concerns.
Use the provided script for quick database setup:
./runDB.shOr manually:
docker pull postgres
docker run --rm --name ebank-postgres -e POSTGRES_USER=ebank -e POSTGRES_DB=ebankdb -e POSTGRES_PASSWORD=ebanksecret -p 5432:5432 -d postgrescd ebank
mvn quarkus:devcd ebank-st
mvn failsafe:integration-test- Quarkus: Supersonic subatomic Java framework optimized for cloud deployments
- PostgreSQL: Popular relational database for transaction consistency
- Jakarta Persistence (JPA): Standard ORM for domain object mapping
- Jakarta REST: RESTful web services following industry standards
- MicroProfile Health: Production-ready health check endpoints
- MicroProfile Metrics: Application performance monitoring
This project demonstrates several Java and architectural conventions:
- BCE/ECB Pattern: Boundary-Control-Entity pattern for clear separation of concerns
- Package by Feature: Components organized by business domain (accounting, bonus, reporting, logging)
- Domain-Driven Package Naming: Packages named after their responsibilities, not technical layers
- Custom Stereotype Annotations:
@Boundaryannotation combining@ApplicationScopedand@Transactional
- Package-info Files: Documentation at package level describing domain responsibilities
- Package-Private Visibility: Preferred over private fields
- Meaningful Names: Classes named after responsibilities, avoiding generic suffixes (*Impl, *Service, *Manager)
- Records: Immutable data carriers (
AccountCreationResult,BonusResult) - Sealed Interfaces:
Transactioninterface with controlled implementations - Pattern Matching: Enhanced switch expressions for type-safe handling
- var Keyword: Local variable type inference for cleaner code
- JAX-RS Resources: REST endpoints with HTTP verbs
- Response Builders: Centralized response creation with status codes
- OpenAPI Annotations: Schema definitions for API documentation
- Metrics Integration:
@Timedannotations for performance monitoring
- JPA Entities: Simple entities with public fields
- EntityManager Usage: Direct use via
@PersistenceContext - JDBC for Reporting: Direct JDBC usage in reporting component for optimized read operations
- Optional Pattern: Consistent use of
Optionalfor nullable returns - Factory Methods: Static factory methods in entities
- CDI Integration: Jakarta CDI with
@Injectfor dependencies - Custom Logger: Centralized
EBLogcomponent for logging
- Stream API: Preference for streams over traditional loops
- Method References: Used instead of verbose lambda expressions
- Immutable Results: Result types as records
- AssertJ Library: Fluent assertions instead of JUnit assertions
- Essential Tests Only: Avoiding repetitive tests, focusing on core functionality
- Integration Tests: Suffix with "IT" for Failsafe plugin execution
- KISS: Keep It Simple - simplest possible solutions
- YAGNI: You Aren't Gonna Need It - no over-engineering
- High Cohesion: Classes with single, well-defined responsibilities
- Low Coupling: Minimal dependencies between components