由于某种原因(shiro过滤器)我将我的应用程序上下文文件保存在WEB-INF文件夹中.当我运行tomcat但是,当我尝试从控制器获取应用程序上下文时,一切正常:
context = new ClassPathXmlApplicationContext(fileContext);
我总是收到这个例外:
IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
似乎在ecplise下我无法在classpath下包含WEB-INF.我在stackoverflow中看了很多问题,但我还没有找到解决方案.
如果我将applicationContext.xml文件移到src / main / java文件夹下,我就可以获取上下文但是,定义到web.xml文件中的shiro filder无法看到在applicationContext文件下定义的shiro bean(我加倍)检查并正确处理bean).如何告诉web.xml从src / main / java获取内容?或者,我如何到达applicationContext.xml