SpringBoot+Thymeleaf->问题1

SpringBoot+Thymeleaf->问题1

H5页面

  <img th:src="files+'/'+${avatar}" ></img>
 <span th:text="${session.user.userName}+',您好!'">张三,您好</span> 

服务端:

类上面

@RequestMapping("/files")

方法上面

@GetMapping("/{filename:.+}")
        @ResponseBody
        public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
                Resource file = storageService.loadAsResource(filename);
                return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
                                "attachment; filename=\"" + file.getFilename() + "\"").body(file);
        }

 主要是 url 拼接问题