| package com.dy.common.util; | 
|   | 
| import java.net.URL; | 
| import org.jdom2.Document; | 
|   | 
| @SuppressWarnings("unused") | 
| public class ConfigXmlNoSpringboot extends ConfigXml { | 
|     /** | 
|      * 在非SpringBoot环境中应用 | 
|      * 创建Document对象 | 
|      * @param clazz 参考类 | 
|      * @param filePath 配置文件路径 | 
|      * @return 返回结果  返回结果返回 doc对象 | 
|      * @throws Exception  抛出异常 抛出异常 | 
|      */ | 
|     public Document createDom(Class<?> clazz, String filePath) throws Exception { | 
|         if(clazz == null){ | 
|             throw new Exception("class对象为空!"); | 
|         } | 
|         if(filePath == null || filePath.equals("")){ | 
|             throw new Exception("配置文件路径名称为空!"); | 
|         } | 
|         if(!filePath.startsWith("/")){ | 
|             filePath = "/" + filePath ; | 
|         } | 
|         URL configFileURL = clazz.getResource(filePath); | 
|         if (configFileURL == null) { | 
|             throw new Exception("没有得到" + filePath + "配置!"); | 
|         } | 
|         return super.doCreateDom(configFileURL) ; | 
|     } | 
|   | 
| } |