banking-kata-java
banking-kata-java copied to clipboard
#34 BankAccountRepository - MongoDB
Hi Valentina,
Hope you are well. Based on your last meetup talk, I have been able to understand the persistence and further worked a little bit on the following for this issue - #34 BankAccountRepository - MongoDB. This is so interesting to me. I have been able to grab a good understanding on mongodb(document) and its spring repository(mongo template).
I hope this seems okay. But May I request you to have a look and see if it is the right way to do it. I have done the following in this PR:
- Added Gradle dependency for mongo template
- Added mongodb and mongodb-express(mongodb admin tool) in the docker-compose while I was working, tested okay.
- Updated ci.yaml file for mongo-db(you may discard it, if it is not needed). I was not able to test it.
- Updated application.yml file with mongo environment variable.
- Under infra--Persistence: Added class - BankAccountDocument (naming convention could be wrong, but I found it relevant as mongo consider document only where string,localdate are the datatype. I understood string seems to be the only datatype. although there are few but string seems to me the dominant.
- Added two repository class: one is custom using mongotemplate and alternatively other one is mongorepository. MongoTemplate seems provide better control as per my understanding.
- Added implementation class of - MongoBankAccountStorage.
Note: Since there are two implementation of BankAccountStorage, therefore two beans for it. I believe there could be toggle in application.yml. For the time being to compile okay, I just made your jpabankaccountstorage as @primary bean.
So, these are above I have done, for your kind review. I apologise if any mistake and would appreciate your kind advice for rework and further enhancement.
Many Thanks, Amin