quote
new ClassPathResource("mpos/mposBat.conf").getFile().getAbsolutePath()
String realPath = this.getClass().getClassLoader().getResource("").getPath();
两句相同效果
file:/C:/danny/code_base/20171031_mpos_bill/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MPayBill/WEB-INF/classes/mpos/mposBat.conf
C:\danny\code_base\20171031_mpos_bill\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MPayBill\WEB-INF\classes\mpos\mposBat.conf
String realPath = this.getClass().getClassLoader().getResource("").getPath();
两句相同效果
file:/C:/danny/code_base/20171031_mpos_bill/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MPayBill/WEB-INF/classes/mpos/mposBat.conf
C:\danny\code_base\20171031_mpos_bill\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MPayBill\WEB-INF\classes\mpos\mposBat.conf