测试静态资源路径
continuous-integration/drone/push Build is passing Details

于相涌/robot_optimize
YXY 1 year ago
parent adf7c85a15
commit fb4a6bfb8c

@ -13,6 +13,8 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.web.bind.annotation.*;
import java.io.File;
@Slf4j
@RestController
public class EdiController extends BaseController {
@ -38,11 +40,19 @@ public class EdiController extends BaseController {
public void exportPdfDemo(@RequestParam("param")String param) throws Exception{
System.out.println(System.getProperty("user.dir"));
ClassPathResource classPathResource = new ClassPathResource("photo/title.png");
System.out.println(classPathResource.getPath());
System.out.println(classPathResource.getURL());
try {
File file = classPathResource.getFile();
System.out.println(file.getName());
}catch (Exception e){
log.error("",e);
}
Resource resource = resourceLoader.getResource("classpath:photo/title.png");
System.out.println(resource.getURL());
System.out.println(classPathResource.getURL());
try {
File file = resource.getFile();
System.out.println(file.getName());
}catch (Exception e){
log.error("",e);
}
// CourseFeedbackTemplateDto resultDTO = new CourseFeedbackTemplateDto();
// resultDTO.setProgram("program");
// resultDTO.setStudentName("student");

Loading…
Cancel
Save