10

My application gets the location of a properties file from an environment variable, and it may not be in the WEB-INF folder. I'm getting file not found, but this file definitely exists already. I don't want to use the classpath: prefix, and I don't want it to be relative to the app root.

@PropertySource("${propfile}")
public class ... {
Alexander Taylor
  • 16,574
  • 14
  • 62
  • 83

1 Answers1

19

To use an absolute path, try file: at the beginning.

@PropertySource("file:${propfile}")

source: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/PropertySource.html

Alexander Taylor
  • 16,574
  • 14
  • 62
  • 83