Posts

Showing posts from 2021

Developing Spring Boot Application using Docker - Part 3

Introduction  Now that we are able to run and Debug the application inside the container let us add Database connection for our service. In this part we will be adding Database service to our Docker Compose file and use that inside the application. For the purposes of simplicity we can use MYSQL as backend database. Get started to build CRUD using Spring Boot To begin with let us add the below to our gradle file to get the required support for our DB We can now define our data model to be added. It is time to create our CRUD repository Lets add our own Service that can be used by the REST Controller Lets add our own Rest Service that can be invoked to access our database With the above code, we should have something to get into our Docker friend. Get your docker stuff ready Let us now add the database for us to test the docker compose This docker compose file has inline comments help you understand what is happening here If you pay close attention to what has be

Developing Spring Boot Application using Docker - Part 2

Image
Hopefully you have now got your Spring Boot Application run inside the container. If you are not there yet, please visit Developing Spring Boot Application using Docker - Part 1 to go start. There is one thing as an Architect on my daily job, I used to ask myself, if we run the application inside the container, how do we debug? How to view logs? How to triage issues on local? The biggest of all is debugging the Spring Boot Application that is running inside the container. Setting up Debugging environment The concept of debugging any Java Based Application that is running inside the container can be done using the most common way is using remote debugging. Typically, whenever we wanted to debug applications that are running in a machine that is outside of our own, we use Remote Debugging. Most IDEs like Eclipse and IntelliJ ship with those capabilities. The good news is, the setup required to get that started are fairly common. Lets see how to get that setup when running on docker. To

Developing Spring Boot Application using Docker - Part 1

Image
Recently I have been stormed by the now old buzz word Docker. I have been reading a lot about Docker for quite some time and found some abundant resources out there on internet. I am planning to add more to the series in my later posts. I will be posing my blogs as and when I am learning and discovering something new in my journey. It's never too late to start something is what I believe. Lets get started. Prerequisites Prerequisites for this project. An IDE of your choice Java 11 Docker Section 1: L ets Start from start.spring.io If you already have a working Spring Boot Application, head to Section 2. We can build the Spring Boot Project by just visiting the below link. URL to generate Simple Spring Boot App on start.spting.io This should get you started with a typical Spring Boot Application Now lets download and extract the project to workspace. Extract files using $ unzip -d ~/your/fav/location/ docker-example.zip or your GUI tool installed on you computer. Now it is time for