How sbathina/bankapp works
Project Type and Purpose
• This is a backend‐only RESTful banking application built with Java 8 and Spring Boot.
• It simulates simple banking operations (CRUD for customers/accounts, deposits, withdrawals, internal transfers) using an in-memory H2 database.
File Structure Analysis
• src/main/java/com/coding/exercise/bankapp
• config – Spring configuration and security setup (ApplicationConfig, SecurityConfig)
• controller – REST controllers (AccountController, CustomerController)
• service – Business logic interfaces and implementations (BankingService, BankingServiceImpl, helper)
• repository – Spring Data JPA repositories (AccountRepository, CustomerRepository, TransactionRepository, etc.)
• model – JPA entity classes mapping to database tables (Customer, Account, Transaction, etc.)
• domain – DTOs used to carry payloads in/out of the API (CustomerDetails, TransactionDetails, TransferDetails, etc.)
• BankingApplication.java – Spring Boot application entry point
• src/main/resources/application.yml – configuration properties (port, datasource URL, etc.)
• pom.xml – declares dependencies: Spring Boot starters (web, data-jpa, security, actuator), H2, Lombok, Swagger
Key Insights from README
• Exposes REST endpoints (base path: /bank-api) secured via Spring Security
• In-memory H2 DB, with console and Swagger UI paths under /bank-api
• Uses Lombok to reduce boilerplate; Maven as build tool
Main Components
a. Client (browser/Postman/Swagger UI)
b. Spring Security filter chain (authentication/authorization)
c. REST Layer – Controllers (AccountController, CustomerController)
d. Service Layer – BankingServiceImpl (business rules, validation, helper classes)
e. Data Layer – Spring Data JPA Repositories
f. Persistence – H2 In-Memory Database (testdb)
g. Supporting Components – Swagger UI, H2 Console, Actuator
Relationships and Data Flow
1. Client sends HTTP request →
2. Spring Security filter intercepts →
3. Controller receives request →
4. Controller calls Service layer →
5. Service performs business logic, may call helper →
6. Service calls Repository →
7. Repository reads/writes to H2 DB →
8. Service returns domain/DTO to Controller →
9. Controller returns HTTP response to Client
Architectural Patterns & Principles
• Layered Architecture (Controller → Service → Repository)
• Dependency Injection (Spring IoC)
• DAO pattern via Spring Data JPA
• DTO mapping between domain (JPA entities) and API payloads
• Configuration segregation (ApplicationConfig vs. SecurityConfig)
Technologies / Frameworks to Highlight
• Spring Boot (auto-configuration, embedded server)
• Spring Security (filter chain, HTTP basic or JWT)
• Spring Data JPA (CRUD Repositories)
• H2 In-Memory DB (persistence)
• Lombok (getters/setters, builders)
• Swagger (REST documentation)
• Maven (build and dependency management)