java代码获取jdbc链接properties

public static String getDirPath() {
        Resource resource = null;
        Properties props = null;
        String driverClass = null;
        try {
            resource = new ClassPathResource("/data.properties");
            props = PropertiesLoaderUtils.loadProperties(resource);
            driverClass= (String) props.get("wingPath");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return driverClass;
        
    }

 

posted @ 2015-12-14 17:32  花语苑  阅读(426)  评论(0编辑  收藏  举报