0

In my theory spring boot is capable of running java web application stand-alone. It says it has a own embedded servlet container and can use JNDI itself.

I built a war file before (spring-mvc, security, gradle built), but Spring boot assemble jar file and it runs on any machine which has JVM.

So my question is, if I made a spring boot based web app (contained JSP files & JNDI for looking up datasource), although it has own embedded servlet container and packaged jar file for running standalone, do I still need to package it as WAR file and deploy it in WAS (Websphere Application Server) or servlet containers for any reasons such as performance, stability, scaling-out etc?

so-random-dude
  • 15,277
  • 10
  • 68
  • 113
the1900
  • 495
  • 1
  • 5
  • 16
  • 1
    you wrote "...jndi for persistence.." - JNDI is "Java Naming and Directory Interface" it has almost nothing to do with persistence – Ralph Oct 25 '16 at 17:33

2 Answers2

6

WAS is an full blown Java Enterprise Application Server, on the other hand you have Spring that only requires a Servlet Container (Servlets are a part of full JEE).

Servlet Containers are for example: Tomcat, Jetty, but also WAS.

Spring Boot is able to package the complete application TOGETHER with the code of Tomcat in an JAR, so that this jar contains the Servlet Container and your Application.

Do I need a additional WAS for performance, stability, scaling-out etc?

  • Performance: No - There should be no important performance differerence between Tomcat and WAS when you run a Spring-Application. (Only that Tomcat needs less memory for itsself)
  • Stability: Tomcat and WAS are both very mature products.
  • Scaling: You can build a cluster of Tomcats by your own.

The main features of WAS over Tomcat are: - WAS supports EJB and CDI (Tomcat would need TomEE for this), but Spring will not use it, because it is its one Dependency Injection container - WAS has more Monitoring features, but this does not matter, because Spring Boot has Actuator

@See Difference between an application server and a servlet container? for more details

Community
  • 1
  • 1
Ralph
  • 118,862
  • 56
  • 287
  • 383
0

Simple answer is No. You do not need any Full blown application servers for any of the reasons that you mentioned (for performance, stability, scaling-out). You can just do fine with tomcat

Edit

Looks like you are using only JNDI feature from the Application server. Do you really need JNDI when you pack your servlet container along with your application ? I don't think so. That days are long gone.

JNDI really shines when you have to move an application between environments: development to integration to test to production. If you configure each app server to use the same JNDI name, you can have different databases in each environment and not have to change your code. You just pick up the WAR file and drop it in the new environment.https://stackoverflow.com/a/7760768/6785908

(If you still need JNDI to be used to look up your data source refer: https://stackoverflow.com/a/24944671/6785908).

No, still I do not really see a reason for packaging your application as WAR and deploy it to traditional application server. That being said, if you have some existing infrastructure lying around and you are being forced to deploy to existing WAS (or WebLogic or JBoss any application server for that matter) server, then I rest my case :).

Community
  • 1
  • 1
so-random-dude
  • 15,277
  • 10
  • 68
  • 113