springboot项目以jar包运行时,读取jar包内的静态文件

springboot项目以jar包运行时,读取jar包内的静态文件

java

import java.io.IOException;

import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.util.ResourceUtils;

public class Test {

	public static void main(String[] args) throws IOException {
		Resource[] resources = new PathMatchingResourcePatternResolver().getResources(ResourceUtils.CLASSPATH_URL_PREFIX + "BOOT-INF/classes/static/*");
	}
}


springboot项目以jar包运行时,读取jar包内的静态文件_第1张图片

你可能感兴趣的:(文件及静态资源,spring,boot)