forked from whgojp/JavaSecLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUploadTest.java
More file actions
28 lines (23 loc) · 899 Bytes
/
UploadTest.java
File metadata and controls
28 lines (23 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package upload;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.core.io.ResourceLoader;
import org.springframework.test.context.BootstrapWith;
import top.whgojp.Application;
import java.net.URL;
@SpringBootTest(classes = Application.class)
public class UploadTest {
@Autowired
private ResourceLoader resourceLoader;
@Test
@SneakyThrows
public void test01() {
// 获取网站根目录
String uploadFolder = resourceLoader.getResource("classpath:/static/upload/xss/").getFile().getPath();
System.out.println(uploadFolder);
}
}