|
From: Colin S. <col...@ex...> - 2003-09-04 16:34:15
|
Currently XmlWebApplicationContext builds up a defualt path for the application context as /WEB-INF/applicationContext.xml then, in AbstractApplicationContext, this is attempted to be loaded via a regular getResourceAsStream call, which fails (as you'd expect it to), then does successfully get loaded via the new FileInputStream(path) call in getResourceByPath(). However, if you look in the Servlet spec, nowhere does it say that the base directory for file operations has to be set to the base directory of the webapp. This certainly does work in JBoss and TomCat, the two environments where I've tried Spring, but I think the much better behaviour would be to rely on the getResourceAsStream() method in ServletContext, which according to the spec _is_ guaranteed to include the web-app base in the classpath searched by that call. One way to handle this would be to implement/override getResourceAsStream in XmlWebApplicationContext, instead of relying on the one in the abstract base class. Regards, Colin |