I have never touched spring knowledge for a long time. I hope I can take a good look at it. Of course, the time is not enough. Of course, I personally do not have much energy. There are still some tricky things on Saturday, so I can only write something when I am clear.Code.
The first step is to run spring as a Java project.ProgramIn fact, let's test how to use the spring container. I learned it through watching the video. It is very detailed and the operations are clear. I am very depressed that the jar package and source code package of spring cannot be found on the official website for download, and other places cannot find good resources. There is no way to do this, you will find the package that you use and reference it to the program. The configuration file template is roughly as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <Beans xmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: context = "http://www.springframework.org/schema/context" xmlns: Tx = "http://www.springframework.org/schema/tx" xsi: schemalocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx hsttp: // www.springframework.org/schema/tx/spring-tx-2.5.xsd "default-autowire =" byname "default-Lazy-init =" true "> </beans>
Most of the configuration files are stored in the class path, that is, the src directory. There are two ways to load the configuration file: one is to find the configuration under the class path
File, of course, this is also the most commonly used, the call method is:
applicationcontext cxt = new classpathxmlapplicationcontext (New String [] {"Beans. xxml"}); the configuration file can be one or multiple. Another way is to find the path in the file system, which requires an absolute path. Considering the porting problem of the program, this method is not feasible. (To be continued)