Containerized Spring boot application is unable to connect to database within container
I seem to be encountering an error within an application that I have created in changing it to be ran via docker.
Connecting docker image(Spring boot app) to MySQL Database
I have an api that i have built an image out of. I am trying to run it using docker compose with the services (database included) I keep getting Connection failure error, I have tried the other solutions I found on the internet to it but I was not able to solve it. At first the app was not connecting to the Db (running in a container) whether it was also running locally(the app) or running inside the container, but after changing the URL to match, I have been able to get the app to work. it now connects to the DB(running on a container) if I run the API locally but when I use docker compose to run the app(running inside a conatiner and the db inside a container), it does not connect to the database.