Develop Container-less Application with Spring Boot

Kasuni Piyumali Waththage
3 min readOct 30, 2022

--

If you started developing Java-based web applications a few years ago, you may remember that you created a web application, and then you deployed this application on a web server or an application server.

Difference between Web server, Web container and App server

The web server is your old friend apache server running on port 80. You deploy a PHP file, HTML file or … and you can start this web server. A web server is a server that handles HTTP requests. Also, the web server is not capable of handling any kind of Java EE specification.

Web containers are the next step. Web containers are capable of handling part of the Java EE specification. The section is servlets.

The application server is capable of handling the full spectrum of the Java EE specification. Application servers handle more than just HTTP requests, they handle RMI calls and so on.

Container applications

When you run your web application on top of a container, the container can handle more than one application. If you have 10 applications running on a single container (eg JBOSS server) and one of your applications has a problem, you need to restart. Then all other 9 apps will be offline.

Nowadays we deploy our application on the cloud and often you don’t have the luxury of restarting your web container. If you use different configurations in different web applications you use, it will not be easy to maintain if two different applications need 2 different versions of the same configuration, then it is quite difficult to configure.

So a container-less application was presented as the solution for these developers.

Container-less application (container within the application)

If you have a container and you port your web application on that container, you need to restart the container while applying some configuration or other.

Instead you embed your web server or container into your application. So when you run your web application it starts a container and it runs on that container. It means that your application comes with its own container. You can do anything to that container because that container has only one dependency and is dedicated to that application.

Advantages

We can restart.

We can have our own configuration because it belongs to us / our app.

Since you are just developing a java application you will have public static void main method (you couldn’t use main method in web applications).

The only thing is that you include your server in it. So when you run your application, it creates a container and runs on it.
Microservices frameworks

Spring boots
Dropwizard
Spark

Spring boot

A leading framework with very good performance, memory footprint and process usage etc.

It comes with dependency injection frameworks and all.

Frameworks have their own HTTP server, REST API, execution framework and other utilities. Spring Boot comes with Spring and Apache.

You should focus only on implementing your business logic.

Spring is a completely open source project.

You don’t need to write starter kit for production app, you can customize and download project zip file from below link.

Thank You!

--

--