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

Loading…
Cancel
Save