The role of the spring xml file with the realization of the principle Spring xml configuration file to read the principles and implementation of introduction and Spring configuration (XML configuration file to configure and comments)

1. the Spring xml configuration file to read the principles and implementation

https://www.cnblogs.com/wyq178/p/6843502.html

 

2. First, the benefits of using xml configuration file parameter configuration items out of the code, easy to manage as well as future maintenance and modification.
Secondly, xml tree node is standardized document, versatility.
Third, a java web project using SSH2 framework of the container at the time of the initial start, it will first read the web.xml , if web.xml configuration inside the spring and struts2 listener, the listener will be by arrangement path and find spring struts configuration file. srping profile is applicationContext.xml, and struts2 configuration file is struts.xml. As may be parsed using the underlying dom parsing mode.

After said analytical procedure is then again called:
when container starts and reads web.xml time, if there is found to configure the listener, it will first enter the initialization method of the listener, and the logic inside the execution code. Listener spring configured to:
<- spring Integration! Struts2 - listener>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </ listener-class>
</ listener>

<-! - a spring disposed listener needs to listen to the profile path ->
<context-param>
<param-name> the contextConfigLocation </ param-name>
<param-value> CLASSPATH: the applicationContext.xml </ param-value>
</ context-param>

Note that the second section of the spring profile path monitor described configuration, i.e. said spring loaded container parameters are defined in the project src: applicationContext.xml in. This time the container reads the configuration file, so they know what to user-defined initialization Bean, to be injected into the object, and so on. For example, if injected in the spring persistence data frame Hibernate, it will initialize the Hibernage the sessionFaction out, and loads the appropriate data source information into memory, thereby obtaining an object in the development dao directly from the container to data persistence related operations. So do not go set up to operate the database which has been time-out and other related parameters in your code. Thereby leading to separation I said at the beginning of the code and configuration items.

3. the Spring Introduction and configuration (XML configuration file to configure and comments)

https://www.cnblogs.com/zhaojiankai/p/8108832.html

Guess you like

Origin www.cnblogs.com/wwmiert/p/11455659.html