Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经在 C:\jboss-as-7.1.1.Final\standalone\deployments\sample.war 中部署了 war 文件,在该部署的 sample.war/web-inf/empInfo.xml
我应该如何在运行时加载 empInfo.xml?
我试过了,它给出了空值
InputStream settingsStream = this.getClass().getClassLoader().getResourceAsStream("empInfo.xml");
您需要将其移动到类路径。该WEB-INF目录不在部署类路径上。将它移到WEB-INF/classes它应该可以找到。
WEB-INF
WEB-INF/classes