• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

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: 22716
129
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.
reply
    Bookmark Topic Watch Topic
  • New Topic