• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Spring Boot - WAR/JAR  RSS feed

Ranch Hand
Posts: 391
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Spring Boot applications, the output file is a jar which is executed. I have few queries regarding Spring Boot apps:

1. As this is a jar file, then where do we have web.xml or other jee web app specific files such as filters in case we have defined some of the filters?

2. How the tomcat is embedded inside the jar and how does it serve as a servlet container inside a jar?
Ranch Hand
Posts: 123
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the spring boot followed the new servlet specifications, where we don't need to define web.xml file.
You can configure all these things which you mentioned(in web.xml) through java files as well.
Posts: 20562
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that everything possible in a web.xml file can be done using annotated Java code. Most cases, including the common ones can, but as I recall, there are some configuration options that don't match up to specific Java code elements, so there's nothing to annotate.

The Spring Boot build process runs Maven, I believe, and part of the process involves building a WAR, which will then be pre-installed into the embedded Tomcat server. The proper location for web.xml, whether Spring Boot or otherwise is /WEB-INF/web.xml. In the case of a Maven build, you'd place the prototype file in the src/main/webapps/WEB-INF/web.xml file.

Since a web.xml is an override to annotations, if you use it, you only need to include stuff that either isn't handled by a Java code annotation or where the code annotation doesn't match the setting you actually want. If you don't have anything that requires that, omit the web.xml file from your source code.
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
global solutions you can do in your home or backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!