essentially, web.xml is just to inject filters (listeners for Server) into Server such as Tomcat , and so on.
and whether it is springMVC.xml or applicationContext.xml , including spring- .xml all belong to Spring configuration files, it doesn't matter what you call it, because you can set the path to the configuration file (or specify the file list directly) in web.xml .
The configuration files for
and Spring are essentially just defining a bunch of Bean , and then setting their initialization dependencies or some property or method settings.
so in fact, there is no difference in configuration mode. In essence, there are only three things: the configuration file of Server and the configuration file of Spring and some configuration files required by third-party packages (such as the configuration file of ORM ). If you like, you can put all the Spring configuration ( Spring MVC configuration, database ( dataSource
, session
, etc.) configuration and even other things into a huge applicationContext.xml and let Spring read it.
so back to your question, it all depends on the classification form you want to use. The common ones are spring- module .xml , where modules include core ( core
), database ( db
), and so on.
the applicationContext-XX in the first link is actually spring-XXX .
personal opinion, may not be completely correct, welcome to discuss, please correct any mistakes!
web.xml configuration web related information such as: monitoring, filter, servlet. The servlet of spring mvc (the startup file (application.xml) of spring-servlet.xml), spring.
spring-servlet.xml spring mvc-related configuration, such as controller scanning, spring mvc-related annotation class effective configuration, and so on.
application.xml spring core configuration is generally divided into multiple files, because spring needs to be integrated with various third parties, such as spring-mybatis.xml spring-redis.xml spring-ecache.xml, etc.
in fact, the train of thought is relatively clear, each file does its own thing, serving each framework.
In the form of
xml configuration, xml looks very complex and hype, but it doesn't come with much. It is recommended to use annotated configuration, which is easier to read and debug than xml, and can play with all kinds of tricks.