This is the User Accounts application, a Spring Boot project designed to manage user transactions. The application leverages Spring WebFlux for reactive programming and integrates with a MySQL database.
- Java Development Kit (JDK) 21 or higher
- Gradle 8.10.2 or higher
- Docker (for running MySQL container)
-
Clone the Repository
Clone the repository to your local machine using the following command:
git clone <repository-url>
-
Navigate to the Project Directory Change into the project directory:
cd user-transactions -
Build the Application Use Gradle to build the application:
./gradlew clean build
This command will compile the source code, run tests, and package the application into a JAR file.
-
Start the MySQL Database Use Docker to start the MySQL database container. Ensure Docker is running and execute the following command:
docker-compose -f compose.yaml up -d
-
Run the Application Start the Spring Boot application using the following command:
java -jar ./build/libs/demo-app-<version>.jar
-
Access the Application Once the application is running, you can access it viahttp://localhost:8080/swagger-ui.html. The application name is configured as demo-app in
application.yaml.
- User Account Management: The application provides endpoints for managing user accounts, including creating, updating, and suspending accounts.
- Transaction Management: Endpoints are available for handling transactions, including debit, credit, and rollback operations.
To run the tests, use the following Gradle command:
./gradlew testThis will execute the test cases defined in the src/test/java directory.
The application is configured using application.yaml. Key configurations include:
- Database Connection: Configured to connect to a MySQL database using R2DBC.
- Logging: Logging levels are set for various packages.
- Spring Data Relational: SQL initialization and R2DBC settings are configured for debugging and development purposes.
- Swagger/OpenAPI: The application uses Swagger for API documentation, as indicated by the
@OpenAPIDefinitionannotation inUserAccountsApplication.java. - Lombok: The project uses Lombok for logging and reducing boilerplate code.
- Reactive Programming: Utilizes Spring WebFlux for non-blocking reactive programming. For further details, refer to the source code and configuration files in the project directory.
