The right location (and also the common practice) is to place them under your source
directory, which will then gets compiled into WEB-INF/classes
directory. I'm not sure what you meant by "classes directory is volatile" in your response to @Dave, but this is how most (if not all) Java web apps store things. WEB-INF/classes
is not just for Java classes. It's common to see logging properties file (like log4j), Hibernate and Spring XML files stored under source
directory and you can safely access the files using something like this:-
// in this case, the business-areas.sql is located right under "source/sql" directory
InputStream is = getClass().getClassLoader().getResourceAsStream("sql/business-areas.sql");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
Some useful information about the use of META-INF: What's the purpose of META-INF?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…