2

In a Spring 'Maven' project, where to place web.xml file?

I am creating a spring mvc project and not sure about where to put web.xml in the project.

4
  • 2
    The location of web.xml is WEB-INF, and this doesn't change because you are using Spring. Commented Jul 31, 2018 at 6:48
  • Thanks @TimBiegeleisen, but I don't have WEB-INF directory in Spring Tool Suite solution Commented Jul 31, 2018 at 6:50
  • If you don't even know where your web.xml file is, then maybe the framework is taking care of it for you. Commented Jul 31, 2018 at 6:51
  • Possible duplicate: stackoverflow.com/questions/19786142/… Commented Jul 31, 2018 at 6:53

3 Answers 3

5

This is an example of a structure of Spring project with maven

├── src
│   └── main
│       ├── java
│       │   └── com
│       │       └── hellokoding
│       │           └── hello
│       │               └── web
│       │                   └── YourClass.java
│       ├── resources
│       │   ├── application.properties
│       │   └── logback.xml
│       └── webapp
│           ├── resources
│           │   ├── css
│           │   │   └── bootstrap.min.css
│           │   ├── images
│           │   └── js
│           │       └── bootstrap.min.js
│           └── WEB-INF
│               ├── views
│               │   └── hello.jsp
|               ├── appconfig-mvc.xml
│               ├── appconfig-root.xml 
│               └── web.xml 
└── pom.xml

From here

Sign up to request clarification or add additional context in comments.

1 Comment

Unless you really typed this out yourself, you should definitely add a source for this information.
1

it's WEB-INF/web.xml Check out the below link ref: https://docs.oracle.com/javaee/5/tutorial/doc/bnadx.html No matter how your archetype structures the project, the final build always follow the specifications. I know the frameworks like spring hides all the specification details and nowadays newbies don't pay attention to all such details. Well knowing specifications and how the frameworks are constructed over these specifications adds value to your software development skills.

Comments

0

web.xml file is always inside WEB-INF folder, by default Maven is expecting it in there and its the first location that is being searched for a web.xml file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.