Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 26, 2022 06:31 pm GMT

How spring boot application work as web application

Spring boot has everything to create a web application and makes web application development fast and hassle-free. The embedded server makes web application creation easy in Spring boot. If embedded server doesn't exist, then we required to install web server like tomcat and deploy application there. After that, only we can use our Java application as web application. But with the help of embedded server, when we create the deployable unit of application i.e JAR, web-server becomes part of it.

Tomcat is the default embedded server for the Spring boot application. So we don't need to do anything to add tomcat in our Spring boot application because it comes with spring boot starter web.

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId></dependency>

If any client makes a request to our Java server, tomcat handles the request.This functionality is made possible by the HTTP Connector element. Two important attributes of HTTP connector are protocol and SSLEnabled. The protocol attribute defines the protocol the connector will use to communicate and bydefault set to HTTP/1.1. SSLEnabled attribute helps connector to decide to use SSL handshake/encryption/decryption. Tomcat has more than one HTTP connector, and we can use anyone. In this blog we will talk about NIO connector.

The NIO connector do non blocking I/O. NIO connector has two thread pools, one holds the poller thread, and other holds the worker thread. Whenever a client makes a request to our Java server, NIO connector uses a thread from poller thread pool and keeps the connection alive. It push these request to handle by the thread from worker threads. Size of both pools are configurable.


Original Link: https://dev.to/amitiwary999/how-spring-boot-application-work-as-web-application-abb

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To