找不到properties
Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [src/main/resources/jdbc.properties] cannot be opened because it does not exist
properties和xml都放在源文件(main/java目錄下)的resources目錄下了
能讀到xml
信息: Loading XML bean definitions from class path resource [spring-annotation.xml]
一月 07, 2017 3:29:50 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring-resource.xml]
一月 07, 2017 3:29:50 下午 org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
信息: Loading properties file from class path resource [src/main/resources/jdbc.properties]
但是后面就報錯了。。。找不到這個文件
test類的classpath:spring-annotation.xml我是放在test目錄下的resources目錄下
上面兩個在源文件下
測試類讀取的xml在測試類自己的resources下
兩個是分開的,我以為都是classpath。。。結(jié)果是不行的
2017-01-07
src/main/resources/jdbc.properties改成:jdbc.properties
總體上可以這么寫:classpath:jdbc.properties