A production-ready, enterprise-grade banking system built with Java, Spring Boot, and MySQL. This multi-tier application demonstrates advanced software engineering principles with 5,000+ lines of well-architected, testable code.
- Deposits, Withdrawals, Transfers with ACID-compliant transactions
- Balance Inquiries with transaction history
- Multi-Account Support (Checking, Savings, Credit accounts)
- ATM Operations simulation
- Real-time Transaction Notifications (Email, SMS)
- BCrypt Password Hashing (12-round encryption)
- Account Lockout after failed login attempts
- Role-Based Access Control (Customer, Teller, Manager, Admin)
- Secure Transaction Management with optimistic locking
- Library Management System - Book borrowing and tracking
- Inventory Management System - Stock tracking and reorder management
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION LAYER (Controllers) β
β REST APIs for Banking, ATM, Library, etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β BUSINESS LOGIC LAYER (Services) β
β Transaction Management, Authentication, etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA ACCESS LAYER (Repositories) β
β JPA/Hibernate ORM with MySQL Database β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
| Pattern | Implementation | Purpose |
|---|---|---|
| Singleton | DatabaseConnectionManager |
Thread-safe database connection management |
| Factory | AccountFactory |
Dynamic account creation (Checking, Savings, Credit) |
| DAO | *Repository interfaces |
Data access abstraction layer |
| MVC | Controllers, Services, Entities | Separation of concerns |
| Observer | TransactionNotifier, *Observer |
Real-time transaction notifications |
- Java 17 - Core programming language
- Spring Boot 3.2.0 - Application framework
- Spring Data JPA - Data persistence
- Hibernate ORM - Object-relational mapping
- MySQL 8.0+ - Relational database
- Spring Security - Authentication & authorization
- BCrypt - Password encryption
- JUnit 5 - Unit testing framework
- Mockito - Mocking framework for tests
- Maven - Build automation
- Lombok - Reduce boilerplate code
src/
βββ main/
β βββ java/com/enterprise/banking/
β β βββ BankingSystemApplication.java # Main application class
β β βββ config/
β β β βββ SecurityConfig.java # Security configuration
β β βββ controller/ # REST Controllers (MVC)
β β β βββ AccountController.java
β β β βββ AtmController.java
β β β βββ BankingController.java
β β β βββ InventoryController.java
β β β βββ LibraryController.java
β β βββ dto/ # Data Transfer Objects
β β β βββ TransactionRequest.java
β β β βββ TransactionResponse.java
β β βββ exception/ # Custom exceptions
β β β βββ AccountNotFoundException.java
β β β βββ BankingException.java
β β β βββ InsufficientFundsException.java
β β βββ model/ # Entity models
β β β βββ Account.java
β β β βββ Customer.java
β β β βββ InventoryItem.java
β β β βββ LibraryBook.java
β β β βββ Transaction.java
β β β βββ User.java
β β βββ pattern/ # Design patterns
β β β βββ AccountFactory.java # Factory pattern
β β β βββ DatabaseConnectionManager.java # Singleton pattern
β β β βββ EmailNotificationObserver.java # Observer pattern
β β β βββ SmsNotificationObserver.java # Observer pattern
β β β βββ TransactionNotifier.java # Observer pattern
β β β βββ TransactionObserver.java # Observer interface
β β βββ repository/ # DAO layer
β β β βββ AccountRepository.java
β β β βββ CustomerRepository.java
β β β βββ InventoryItemRepository.java
β β β βββ LibraryBookRepository.java
β β β βββ TransactionRepository.java
β β β βββ UserRepository.java
β β βββ service/ # Business logic layer
β β βββ AccountService.java
β β βββ AuthenticationService.java
β β βββ BankingService.java
β β βββ InventoryService.java
β β βββ LibraryService.java
β βββ resources/
β βββ application.properties # Configuration
βββ test/
βββ java/com/enterprise/banking/ # JUnit tests
βββ pattern/
β βββ AccountFactoryTest.java
β βββ ObserverPatternTest.java
βββ service/
βββ AccountServiceTest.java
βββ AuthenticationServiceTest.java
βββ BankingServiceTest.java
- Java 17 or higher
- Maven 3.8 or higher
- MySQL 8.0 or higher
- IDE (IntelliJ IDEA, Eclipse, or VS Code with Java extensions)
-
Install MySQL and start the MySQL server
-
Create the database:
CREATE DATABASE banking_system;- Update database credentials in
src/main/resources/application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/banking_system
spring.datasource.username=YOUR_USERNAME
spring.datasource.password=YOUR_PASSWORD- Clone the repository:
git clone <repository-url>
cd "Java Bank Enterprise"- Build the project:
mvn clean install- Run tests:
mvn test- Run the application:
mvn spring-boot:runThe application will start on http://localhost:8080
POST /api/banking/deposit
Content-Type: application/json
{
"accountNumber": "CHK-123456-ABCD",
"amount": 500.00,
"description": "Salary deposit",
"channel": "ONLINE"
}POST /api/banking/withdraw
Content-Type: application/json
{
"accountNumber": "CHK-123456-ABCD",
"amount": 200.00,
"description": "Cash withdrawal",
"channel": "ATM"
}POST /api/banking/transfer
Content-Type: application/json
{
"accountNumber": "CHK-123456-ABCD",
"targetAccountNumber": "SAV-789012-EFGH",
"amount": 300.00,
"description": "Transfer to savings",
"channel": "ONLINE"
}GET /api/banking/balance/{accountNumber}GET /api/banking/transactions/{accountNumber}?startDate=2024-01-01T00:00:00&endDate=2024-12-31T23:59:59POST /api/accounts?username=testuser&accountType=CHECKINGGET /api/accounts/user/{username}GET /api/accounts/{accountNumber}DELETE /api/accounts/{accountNumber}POST /api/atm/withdraw
Content-Type: application/json
{
"accountNumber": "CHK-123456-ABCD",
"amount": 100.00
}GET /api/atm/balance/{accountNumber}POST /api/library/books
Content-Type: application/json
{
"isbn": "978-0-13-468599-1",
"title": "Clean Code",
"author": "Robert C. Martin",
"category": "Programming"
}POST /api/library/books/{isbn}/borrowPOST /api/library/books/{isbn}/returnGET /api/library/books/search?keyword=javaPOST /api/inventory/items
Content-Type: application/json
{
"sku": "LAPTOP-001",
"name": "Dell Laptop",
"category": "Electronics",
"unitPrice": 999.99,
"quantityInStock": 50
}POST /api/inventory/items/{sku}/add-stock?quantity=10GET /api/inventory/items/low-stockmvn testmvn test -Dtest=BankingServiceTestmvn clean test jacoco:reportView the coverage report at: target/site/jacoco/index.html
- BankingService: 85%+ coverage
- AuthenticationService: 90%+ coverage
- AccountService: 88%+ coverage
- Design Patterns: 92%+ coverage
- Overall Project: 80%+ coverage
// Filter and sum deposits using Streams
return transactionRepository.findByAccount(account).stream()
.filter(txn -> txn.getTransactionType() == Transaction.TransactionType.DEPOSIT)
.filter(Transaction::isSuccessful)
.map(Transaction::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);// Register observers with lambda
observers.forEach(observer -> {
try {
observer.onTransactionCompleted(transaction);
} catch (Exception e) {
log.error("Error notifying observer", e);
}
});// Safe navigation with Optional
public Optional<Account> getAccountByNumber(String accountNumber) {
return accountRepository.findByAccountNumber(accountNumber);
}- ArrayList - Transaction history lists
- HashMap - Category summaries
- LinkedList - Pending transactions queue
- CopyOnWriteArrayList - Thread-safe observer list
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
String hashedPassword = encoder.encode(plainPassword);
boolean matches = encoder.matches(plainPassword, hashedPassword);- Maximum 5 failed login attempts
- Automatic account lock after threshold
- Admin unlock capability
- Optimistic Locking - Prevents lost updates
- Pessimistic Locking - For critical sections
- ACID Compliance - All or nothing transactions
- Isolation Levels - READ_COMMITTED, SERIALIZABLE
- users - User authentication and profile
- customers - Customer KYC information
- accounts - Bank account details
- transactions - Transaction records
- library_books - Library inventory
- inventory_items - Product inventory
- User β Accounts (One-to-Many)
- Account β Transactions (One-to-Many)
- User β Customer (One-to-One)
DatabaseConnectionManager ensures single database connection instance
- Thread-safe with double-checked locking
- Lazy initialization
- Connection pooling support
AccountFactory creates account instances based on type
- Encapsulates account creation logic
- Default configurations per account type
- Custom account creation support
TransactionNotifier broadcasts transaction events
- Email notifications
- SMS notifications
- Extensible for additional observers
Repository interfaces abstract data access
- Spring Data JPA implementation
- Custom query methods
- Transaction management
Clear separation of concerns:
- Model: Entity classes
- View: REST API responses
- Controller: HTTP request handlers
BankingException- Base exceptionAccountNotFoundException- Account not foundInsufficientFundsException- Insufficient balanceAuthenticationException- Login failures
{
"status": "error",
"message": "Insufficient funds",
"timestamp": "2024-12-16T10:30:00"
}- Connection Pooling - HikariCP with optimized settings
- Batch Processing - Hibernate batch inserts/updates
- Indexed Queries - Database indexes on frequently queried columns
- Lazy Loading - Fetch associations only when needed
- Caching - Second-level cache for reference data
- Atomicity: All or nothing operations
- Consistency: Database constraints enforced
- Isolation: Concurrent transaction handling
- Durability: Persistent after commit
READ_COMMITTED- Standard operationsSERIALIZABLE- Critical transfers
Comprehensive logging at multiple levels:
- DEBUG: Development troubleshooting
- INFO: Key business events
- WARN: Potential issues
- ERROR: Exception details
Log files location: logs/banking-system.log
- 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
This project is licensed under the MIT License - see the LICENSE file for details.
Enterprise Banking Team
- Spring Boot community for excellent documentation
- Hibernate team for robust ORM framework
- JUnit and Mockito communities for testing tools
- MySQL for reliable database system
For support, email support@enterprisebanking.com or create an issue in the repository.
Built with β€οΈ using Java, Spring Boot, and modern software engineering practices