Is there a variety of configurations for SSM integration?

I have been learning SSM, recently, although there is no problem with using the three spring,springMVC,Mybatis frameworks alone, but the way I look at the integration does not seem to be fixed, which makes me very confused. Maybe there is something wrong with my understanding.
I noticed that different configuration files are used for different integration methods, web.xml and springMVC.xml are definitely used, and the configuration contents of the two files are basically the same. However, some of the remaining configuration files will use SqlMapConfig.xml and applicatonContext.xml, and applicatonContext will be divided into several configuration files according to the contents of the configuration, while others will only use spring-mybatis.xml.
is the difference between the two configurations to cope with different applicable scenarios? What is the purpose of these two different configurations?

There are two types of

:
https://blog.csdn.net/baidu_3.

.

https://blog.csdn.net/yijiema.

Mar.22,2021

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.

Menu