日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

spring resource

發布時間:2025/4/5 编程问答 15 豆豆
生活随笔 收集整理的這篇文章主要介紹了 spring resource 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.resource的前生后世

? 前生:public interface Resource extends InputStreamSource

public interface InputStreamSource {/*** Return an {@link InputStream}.* <p>It is expected that each call creates a <i>fresh</i> stream.* <p>This requirement is particularly important when you consider an API such* as JavaMail, which needs to be able to read the stream multiple times when* creating mail attachments. For such a use case, it is <i>required</i>* that each <code>getInputStream()</code> call returns a fresh stream.* @throws IOException if the stream could not be opened* @see org.springframework.mail.javamail.MimeMessageHelper#addAttachment(String, InputStreamSource)*/InputStream getInputStream() throws IOException;}

后世:

2.Resource輔助工具類ResourceUtils

1 /** Pseudo URL prefix for loading from the class path: "classpath:" */ 2 public static final String CLASSPATH_URL_PREFIX = "classpath:"; 3 4 /** URL prefix for loading from the file system: "file:" */ 5 public static final String FILE_URL_PREFIX = "file:"; 6 7 /** URL protocol for a file in the file system: "file" */ 8 public static final String URL_PROTOCOL_FILE = "file"; 9 10 /** URL protocol for an entry from a jar file: "jar" */ 11 public static final String URL_PROTOCOL_JAR = "jar"; 12 13 /** URL protocol for an entry from a zip file: "zip" */ 14 public static final String URL_PROTOCOL_ZIP = "zip"; 15 16 /** URL protocol for an entry from a JBoss jar file: "vfszip" */ 17 public static final String URL_PROTOCOL_VFSZIP = "vfszip"; 18 19 /** URL protocol for an entry from a WebSphere jar file: "wsjar" */ 20 public static final String URL_PROTOCOL_WSJAR = "wsjar"; 21 22 /** URL protocol for an entry from an OC4J jar file: "code-source" */ 23 public static final String URL_PROTOCOL_CODE_SOURCE = "code-source"; 24 25 /** Separator between JAR URL and file path within the JAR */ 26 public static final String JAR_URL_SEPARATOR = "!/";

3.resource的繼承關系:(http://www.ibm.com/developerworks/cn/java/j-lo-spring-principle/index.html 圖 8. Resource 相關的類結構圖

圖 9. Context 和 Resource 的類關系圖

從上圖可以看出,Context 是把資源的加載、解析和描述工作委托給了 ResourcePatternResolver 類來完成,他相當于一個接頭人,他把資源的加載、解析和資源的定義整合在一起便于其他組件使用。

轉載于:https://www.cnblogs.com/davidwang456/archive/2013/03/21/2972916.html

總結

以上是生活随笔為你收集整理的spring resource的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。