That's the reason not to put configuration into webapp
.
As far as I know, there are no good ways to access files in webapp
folder from the unit tests. You can put your configuration into src/main/resources
instead, so that you can access it from your unit tests (as described in the docs), as well as from the webapp (using classpath:
prefix in contextConfigLocation
).
See also: