Container-less Application Development

Before going for the container-less application, as the initial phase let's see what are the causes that lead developers towards the container-less application development. To get a clear understanding of this article, it is worth reading my previous article about container-based development. When comes to the container it has the capability to handle several applications inside it and suddenly there is a problem that occurred in one application and we need to restart it; In such scenarios, we need to restart the complete container and it results in restarting other applications too and they are offline. But it is not a good practice. Because we are writing high availability business applications and it is not a fair thing that we stop their functions for the sake of problem in one application. Another reason is that in today world, most of the containers are deployed in the cloud environment and in there we most of the time, it doesn’t allow to restart the applications. Next point is that if we need to config different versions of the same configuration to run the different web applications in the same container, it is a very complex task. To overcome those challenges developers tend to develop container-less applications.
What is a Container-less Application? 🤔
Think about the above problems, those have occurred because those applications are deployed inside the containers. So what if we can embed a container into the web application and then we start the application, container also starts and then the application runs on top of that. So this concept is known as the container-less application. What does it mean is, applications are come up with their own container. Having an own container means the application can work independently without worrying about other applications.
Advantages 👍
- Simplified development — Developers run the application exactly the same way in development as in production. This reduces the possibility of errors from differences between running in development and running in production. It highly reduces the possibility of occurring server- specific errors
- Easy deployment — There’s no copying from here to there, and there’s no extra server configuration that you need to maintain separately from the application. Therefore it deployment process is very easy
- Faster startup — With an embedded server there is less for the container to do and it can start in mere seconds
- Fewer classloader issues — Fewer classloaders means fewer classloader issues.
- Better IDE support — Since it’s a regular application instead of something hosted in a web server, it can be easily started and stopped by any IDE without special plugins and without attaching a server to your IDE
If you are a java developer, when you developing a normal web application you don’t use the main method (public static void main). But if you are using this type of containerized web application it just like you are implementing a general java application. The only difference is you are embedding your server into that application. At the running time, this application creates a container and then it runs on it. I think now you have a clear idea about that and let’s move to the development of a container-less application.
Implementation 💻
For the implementation, here I am using the Spring Boot framework as it is widely used in the industry for its high performance, memory footprint and its processor usage ability. It automatically comes with a dependency injection framework. How these frameworks are working is it has their own HTTP server, REST API and other utilities. When comes to the spring boot, it has Spring and Apache.
Step 01 — First of all you have to create a simple maven project and here you have to choose the archetype called “maven-archetype-quickstart “ and fill in other maven settings for the GroupId, ArtifactId and project name etc.
Step 02 — Open the pom.xml file and then add the parent information and spring boot dependency. Your pom file should look like that.
Step 03 — Next step is you need to create a java class with the main method to convert the project into the spring-boot application. (You can easily create a spring boot project, but following these steps, you can get a clear idea about the process)
Step 04 — As the next step, you need to create a separate package called the controller and create a controller class named GreetingController.java inside the package. To convert that class as a controller you need to add @RestController annotation at the top of the file. Then you have to create a greeting method inside the class. The following code snippet shows the example of my greeting controller class.
Step 05 — Then run your application and then check the localhost:8080 and then you can see the output. See that in a few minutes we create a small web application.

I think that now you have a clear idea about container-less application development and its advantages and why we need to go for this type of application development. If you need further information use the references for that.