我想使用BeanFactory創建bean,但我得到一個模糊:java.io.FileNotFoundException: \\WEB-INF\businesscaliber-servlet.xml
。在Spring中獲取FileNotFoundException
Resource res = new FileSystemResource("//WEB-INF//businesscaliber-servlet.xml");
BeanFactory factory = new XmlBeanFactory(res);
if (factory != null && beanId != null) {
obj = factory.getBean(beanId);
}
他其使用該
的ApplicationContext環磷酰胺=新FileSystemXmlApplicationContext來工作( 「類路徑*:/ WEB-INF/businesscaliber-servlet.xml文件」);
它是新的ServletContextResource()正確的語法? – Vicky 2010-01-16 04:56:53
我能找到解決方案使用此 ApplicationContext ctx = new FileSystemXmlApplicationContext(「classpath *:/ WEB-INF/businesscaliber-servlet.xml」); – Vicky 2010-01-16 05:32:49