UserBean.class.getClassLoader().getResource(filePath).getPath()
或者
Thread.currentThread().getContextClassLoader().getResource(filepath).getPath();