获取文件

1
2
3
4
5
6
7
8
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;


PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource resource = resolver.getResource("classpath:test.dat");
Resource resource2 = resolver.getResource("file:C:/test.dat");
Resource resource3 = resolver.getResource("WEB-INF/test.dat");
>