Classpathxmlapplicationcontext Problems in 1.Spring
Classpathxmlapplicationcontext is loading the corresponding XML file from the Classpath class load path.
(1) Generally use classpath path, prefix can be added without adding,
Example: New Classpathxmlapplicationcontext ("Classpath:conf/core/train-servlet.xml")
(2) You can also use absolute path, plus file: Absolute path, generally not recommended absolute path
2. Filesystemxmlapplicationcontext:
(1) using the path of the file system, the default specifies the root path of the project, SRC
Example: New Filesystemxmlapplicationcontext ("Src/conf/core/train-servlet.xml")
(2) You can also use the classpath path so that you can read the relative path below the classpath,
Example: New Filesystemxmlapplicationcontext ("Classpath:conf/core/train-servlet.xml")
(3) No need to add File: prefix denotes absolute path, do not advocate use
1. No drive letter is the project work path, that is, the root directory of the project; Src
2. A drive symbol indicates the absolute path of the file. D:\test\ Error Problem:
Noclassdeffounderror The reason is that the corresponding class is not found and the corresponding bean in the Spring.xml file is configured incorrectly.
Classpathxmlapplicationcontext and Filesystemxmlapplicationcontext path issues