标签:
一 文件放在classpath下面
1. 直接获取InputStream
InputStream inputStream = Thread.currentThread()
.getContextClassLoader().getResourceAsStream("user_table.xml");
2. 获取resource和path
URL resource = Thread.currentThread().getContextClassLoader() .getResource("user_table.xml"); String path = resource.getPath();
标签:
原文地址:http://www.cnblogs.com/tangyanbo/p/4283376.html