创建微服务时, 可以将静态资源(前端界面)放入resource中, 通过接口来访问
参考博客: https://blog.csdn.net/wangxin1949/article/details/89016428
@Controller
@RequestMapping(“/terminal/task”)
public class TaskResultController {
@GetMapping("/result/{taskId}")
public String toPage(@PathVariable("taskId") String taskId, Model model) {
model.addAttribute("resultDataUrl",
TaskScheduleProperties.instance().getResultDataUrl() + NormalizerUtil.replaceCRLF(taskId));
return "result/taskResult"; // 静态资源(也就是前端界面)的存储位置
}
@GetMapping("/sim_result/{taskId}")
public String toSimCheckResultPage(@PathVariable("taskId") String taskId, Model model) {
model.addAttribute("resultDataUrl",
TaskScheduleProperties.instance().getResultDataUrl() + NormalizerUtil.replaceCRLF(taskId));
return "result/simTaskResult"; // 静态资源(也就是前端界面)的存储位置
}
}
注意添加@Controller注解,
可以自行再了解下@Controller 和 @RestController的区别