Spring boot web application types

0

In this article, we will see how spring boot derives the application type. There are three types of application:

  1. Normal application which is non-web based and doesn’t require any web server
  2. Web application where spring boot would start an embedded web server
  3. Reactive web application where spring boot would start an embedded reactive web server

When a spring boot application is started, this is the first thing spring boot would do, that is, to derive the application type.

How does spring boot derives the application type

Spring boot will look for specific classes in order to conclude the application type.

Reactive Web Application

If spring finds class org.springframework.web.reactive.DispatcherHandler which means the application has included jars that supports reactive-stack web applications and can be run on non-blocking web servers. Spring boot will also make sure that it doesn’t find any classes related to normal web server like org.springframework.web.servlet.DispatcherServlet and org.glassfish.jersey.servlet.ServletContainer

Web application

If the application is not a reactive web application and below web classes are present then spring will consider this as web application.

  1. javax.servlet.Servlet
  2. org.springframework.web.context.ConfigurableWebApplicationContext

Non-web application type

If application is neither reactive nor web then it will fall into the normal category.

Share.

Comments are closed.