Configuring Web. XML for any JAVA/J2EE using programming methods
Introduction
this articleIntroductiontheJavaand theThe EE projectUseanya programming methodof theWeb. XMLConfiguration
Background
As a traditional approach, the configuration of any servlet context and other listeners in Java and EE Web applications is configured in the. xml file.
In contrast, the Servlet 3 introduction is intended to provide a practical way to configure entries for the Web. Xml.
Any servlet 3 based Web application can implement a Servletcontainerinitializer interface that explicitly passes ServletContext at run time as a container.
This can be used to configure Servlets, listeners, any filters, and others that need to be configured by the Web. xml file.
The advanced Spring Framework is more than 3.1 and is implemented more easily because it provides servletcontainerinitializer called Springservletcontainerinitializer implementations.
Basically, in the Spring Web module file It will be implemented through this/service/Java.servlet.servletcontainerinitializer.
At the same time, configuring the servlet context listeners, tasks, and filters will be delegated to another interface called Webapplicationinitializer.
The only task for developers is to implement Webapplicationinitializer and implement configuration servlet contexts.
Let's look at an example of how to implement the same as a typical configuration.
Hand-hit translation, please click Read the original
More Java,java learning, Java face Test http://techfoxbbs.com
A programming method for configuring Web. Xml