简体   繁体   中英

Spring - java.io.FileNotFoundException

i am working on a simple spring project ; actually trying the injection through the properties file. i have to get the prop file in my applicationContext.xml file which they are not under the same directry :

/src |_.com.luv2code.springdemo | |_sport.properties |_resources |_applicationContext.xml

Trying to use this , but couldn't figure out the right classpath

<context:property-placeholder location="classpath:/sport.properties"/>
  1. It should be src/main/com.luv2code… , not just src/com.luv2code… .
  2. Slash denotes classpath root, but your resource seem to lay in com.luv2code.springdemo package.
  3. Put sport.properties in the resources directory: src/main/resources .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM