Durian: web.xml

GitHub: https://github.com/SylkeWay/synthful

First, look at the web app definition file:

/durian/src/main/webapp/WEB-INF/web.xml .

web-app enclosure
  • As stated previously, this project uses servlet 3.1 .
  • Note that servlet 2.5 onwards, any occurrences of  {j2ee} in all its namespaces have been replaced with {javaee}.

Spring context bootstrap

web.xml provides the facility to specify bootstrap classes. Spring's ContextLoaderListener class is needed to be bootstrapped to perform its component based actions.

Custom location of Spring configuration files

The location of all the text and data files are consolidated under the source folder

Spring, not including webmvc, configuration files are placed under

Therefore, Spring should be notified through the {contextConfigLocation} parameter that such configuration files should be found in the classpath
/spring/ .

Spring is instructed to look under the folder /spring/ and its subfolders for files with names constrained by the pattern **-context.xml,
i.e. whose names end with  -context.xml .

The parameter value must define a namespace that is accessible by the web app during run-time. Which could either be
  • classpath:{a classpath commalist}
  • a plain folder path rooted from the web app context root, e.g.,

Spring mvc bootstrap

Since Spring webmvc operates on the servlet frontend (i.e. frontend of the server side, not the client frontend), its component-action bootstrap is a servlet: org.springframework.web.servlet.DispatcherServlet .

Similarly, the webmvc bootstrap servlet would look for components through a context configuration file, and therefore too has its own  {contextConfigLocation} parameter, to instruct Spring webmvc to look for all its context configuration files under the classpath

No comments:

Post a Comment