During the use of the spring MVC process, the deployment project error, error message is as follows:
August 15, 2016 5:02:04 pm Org.apache.catalina.core.StandardContext listenerstart
Severity: Exception sending context initialized event to listener instance of class Org.springframework.web.context.ContextLoad Erlistener
Org.springframework.beans.factory.BeanInitializationException:Could not load properties; Nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/db.properties]
At Org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory ( propertysourcesplaceholderconfigurer.java:151)
.......
At Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61)
At Java.lang.Thread.run (Unknown Source)
caused by: java.io.FileNotFoundException:Could not open ServletContext resource [/db.properties]
At Org.springframework.web.context.support.ServletContextResource.getInputStream (Servletcontextresource.java : 141)
At Org.springframework.core.io.support.EncodedResource.getInputStream (encodedresource.java:153)
... Wuyi more
......................................................................................................................... ......................................................
MAVEN projects, Application-context.xml, db.properties files are placed in the Src/main/resources directory, Tomcat deployment project, src/main/ The configuration file under the Resources directory has the default location: {The project name is}/web-inf/classes, but spring is not found in the project root directory, so you can find it by specifying the CLASSPATH directory when configuring.
The solution is as follows:
<context:property-placeholder location= "classpath:db.properties"/>
Spring deployment Error: Could not open ServletContext resource [/db.properties]