package com.jiankunking.elasticsearch.extension.util;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import java.io.IOException;
import java.io.InputStream;
/**
 * @author jiankunking.
 * @date:2018/10/12 18:20
 * @description:
 */
public class ResourceRenderer {
    public static InputStream resourceLoader(String fileFullPath) throws IOException {
        ResourceLoader resourceLoader = new DefaultResourceLoader();
        return resourceLoader.getResource(fileFullPath).getInputStream();
    }
}
使用:
String fileName = "classpath:/k8s/kubectl.kubeconfig";
InputStream inputStream = ResourceRenderer.resourceLoader(fileName);
资源目录: 
个人微信公众号: 
作者:jiankunking 出处:http://blog.csdn.net/jiankunking

 
                 
    