• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Spring boot - servelt api

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I am doing simple "Hello World" spring boot project . I don't see servlet-api implementation jar in maven dependencies list ,  From where the implementation is provided to application ?
 
Sheriff
Posts: 22210
117
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

When using Maven, you only need to have a provided dependency for the servlet API. For "regular" applications that's either javax.servlet:javax.servlet-api or jakarta.servlet:jakarta.servlet-api. Which one depends on the server and version; only the more recent versions will use the Jakarta variant. You just use the API, and because the dependency is provided it won't be bundled with your application. Instead, the servlet container (Tomcat, Jetty, JBoss, etc.) will provide the implementation.

Spring Boot and Quarkus are different though. With these you don't build an application that's deployed in a servlet container. Instead, the bundled application comes with an embedded container that provides the implementation. I think they currently use Tomcat and/or Undertow.

With Spring Boot you don't include the servlet API as a dependency yourself. Instead, you use a starter. I like to use https://start.spring.io/ to find the starters. For web applications, that's org.springframework.boot:spring-boot-starter-web. That comes with the embedded Tomcat container I mentioned. It also provides the servlet API dependency for you.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic