雜七雜八
Resource 資源取得
FileSystemResource
文件系統底下(即主機),相對項目路徑,或文件系統的絕對路徑。
ClassPathResource
在 classpath 底下查找,預設為 src 底下。
常用 viewResolver
InternalResourceViewResolver
透過定義 prefix / suffix,在解析完成時拿到的 String 字串,再從 resource 取得對應位置的視圖文件。
如:prefix = / WEB_INF/views/ ; suffix = .jsp,就會找 / WEB_INF/views/
String字串
.jsp 文件。
Springboot 2.1.X starter 中 Thymeleaf:
定義放在 org.springframework.boot.autoconfigure.thymeleaf 的 ThymeleafProperties 中。
MultiPartResolver
Spring 帶有兩種具體實現:
Jakarta Common FileUpload 的 CommonsMultiResolver。
Servlet 3.0 Part API 的 StandardServletMultipartResolver。
Springboot 2.1.X MVC 使用 StandardServletMultipartResolver:
定義在 org.springframework.boot.autoconfigure.web 的 MultipartAutoConfiguration.class 。
Last updated
Was this helpful?