Embedding tomcat server into an application


What is an embedded server?

A web application runs on a web server, usually they are packaged in a WAR file and deployed in a server container like Tomcat, JBOSS or GlassFish. However embedded servers provide an interesting alternative. Instead of deploying your app in a server, the server is embedded inside your application The result is a standalone application packaged in a jar file and that could be executed from a command line.

To run an embedded tomcat server we just need following jars

tomcat-embed-core
tomcat-embed-logging-juli

Find this project on Github

https://github.com/javacodenet/embeddedTomcatDemo

pom.xml


EmbeddedTomcatStarter.java


application.properties


Output


Comments

Popular posts from this blog

Generate Random values in Spring boot

Generate PDF From XML Or Java Object Using Apache FOP

Generate/Read an Excel file in Java using Apache POI