Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Meiracle
spring-framework
提交
03f1b650
S
spring-framework
项目概览
Meiracle
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
03f1b650
编写于
1月 26, 2021
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish Javadoc for ResourceLoader APIs
上级
0de28338
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
29 deletion
+31
-29
spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java
...java/org/springframework/context/ResourceLoaderAware.java
+6
-6
spring-core/src/main/java/org/springframework/core/io/ResourceLoader.java
...main/java/org/springframework/core/io/ResourceLoader.java
+14
-14
spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternResolver.java
...ingframework/core/io/support/ResourcePatternResolver.java
+11
-9
未找到文件。
spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java
浏览文件 @
03f1b650
/*
* Copyright 2002-20
19
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -26,10 +26,10 @@ import org.springframework.core.io.ResourceLoader;
* the {@link org.springframework.context.ApplicationContextAware} interface.
*
* <p>Note that {@link org.springframework.core.io.Resource} dependencies can also
* be exposed as bean properties of type {@code Resource}
, populated via Strings
*
with automatic type conversion by the bean factory. This removes the need for
*
implementing any callback interface just for the purpose of accessing a
*
specific file resource
.
* be exposed as bean properties of type {@code Resource}
or {@code Resource[]},
*
populated via Strings with automatic type conversion by the bean factory. This
*
removes the need for implementing any callback interface just for the purpose
*
of accessing specific file resources
.
*
* <p>You typically need a {@link ResourceLoader} when your application object has to
* access a variety of file resources whose names are calculated. A good strategy is
...
...
@@ -48,7 +48,7 @@ import org.springframework.core.io.ResourceLoader;
* default; see also the {@code ResourcePatternUtils.getResourcePatternResolver} method.
*
* <p>As an alternative to a {@code ResourcePatternResolver} dependency, consider
* exposing bean properties of type {@code Resource} array, populated via pattern
* exposing bean properties of type {@code Resource
[]
} array, populated via pattern
* Strings with automatic type conversion by the bean factory at binding time.
*
* @author Juergen Hoeller
...
...
spring-core/src/main/java/org/springframework/core/io/ResourceLoader.java
浏览文件 @
03f1b650
/*
* Copyright 2002-20
18
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,15 +20,15 @@ import org.springframework.lang.Nullable;
import
org.springframework.util.ResourceUtils
;
/**
* Strategy interface for loading resources (e.
.
class path or file system
* Strategy interface for loading resources (e.
g.,
class path or file system
* resources). An {@link org.springframework.context.ApplicationContext}
* is required to provide this functionality
,
plus extended
* is required to provide this functionality plus extended
* {@link org.springframework.core.io.support.ResourcePatternResolver} support.
*
* <p>{@link DefaultResourceLoader} is a standalone implementation that is
* usable outside an ApplicationContext
,
also used by {@link ResourceEditor}.
* usable outside an ApplicationContext
and is
also used by {@link ResourceEditor}.
*
* <p>Bean properties of type
Resource and Resource array
can be populated
* <p>Bean properties of type
{@code Resource} and {@code Resource[]}
can be populated
* from Strings when running in an ApplicationContext, using the particular
* context's resource loading strategy.
*
...
...
@@ -46,7 +46,7 @@ public interface ResourceLoader {
/**
* Return a
Resource
handle for the specified resource location.
* Return a
{@code Resource}
handle for the specified resource location.
* <p>The handle should always be a reusable resource descriptor,
* allowing for multiple {@link Resource#getInputStream()} calls.
* <p><ul>
...
...
@@ -56,10 +56,10 @@ public interface ResourceLoader {
* (This will be implementation-specific, typically provided by an
* ApplicationContext implementation.)
* </ul>
* <p>Note that a
Resource
handle does not imply an existing resource;
* <p>Note that a
{@code Resource}
handle does not imply an existing resource;
* you need to invoke {@link Resource#exists} to check for existence.
* @param location the resource location
* @return a corresponding
Resource
handle (never {@code null})
* @return a corresponding
{@code Resource}
handle (never {@code null})
* @see #CLASSPATH_URL_PREFIX
* @see Resource#exists()
* @see Resource#getInputStream()
...
...
@@ -67,12 +67,12 @@ public interface ResourceLoader {
Resource
getResource
(
String
location
);
/**
* Expose the
ClassLoader used by this ResourceLoader
.
* <p>Clients which need to access the
ClassLoader
directly can do so
* in a uniform manner with the
ResourceLoader
, rather than relying
* on the thread context
ClassLoader
.
* @return the
ClassLoader
* (only {@code null} if even the system
ClassLoader
isn't accessible)
* Expose the
{@link ClassLoader} used by this {@code ResourceLoader}
.
* <p>Clients which need to access the
{@code ClassLoader}
directly can do so
* in a uniform manner with the
{@code ResourceLoader}
, rather than relying
* on the thread context
{@code ClassLoader}
.
* @return the
{@code ClassLoader}
* (only {@code null} if even the system
{@code ClassLoader}
isn't accessible)
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
* @see org.springframework.util.ClassUtils#forName(String, ClassLoader)
*/
...
...
spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternResolver.java
浏览文件 @
03f1b650
/*
* Copyright 2002-20
07
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -23,17 +23,18 @@ import org.springframework.core.io.ResourceLoader;
/**
* Strategy interface for resolving a location pattern (for example,
* an Ant-style path pattern) into
Resource
objects.
* an Ant-style path pattern) into
{@link Resource}
objects.
*
* <p>This is an extension to the {@link org.springframework.core.io.ResourceLoader}
* interface. A passed-in
ResourceLoader
(for example, an
* interface. A passed-in
{@code ResourceLoader}
(for example, an
* {@link org.springframework.context.ApplicationContext} passed in via
* {@link org.springframework.context.ResourceLoaderAware} when running in a context)
* can be checked whether it implements this extended interface too.
*
* <p>{@link PathMatchingResourcePatternResolver} is a standalone implementation
* that is usable outside an ApplicationContext, also used by
* {@link ResourceArrayPropertyEditor} for populating Resource array bean properties.
* that is usable outside an {@code ApplicationContext}, also used by
* {@link ResourceArrayPropertyEditor} for populating {@code Resource} array bean
* properties.
*
* <p>Can be used with any sort of location pattern (e.g. "/WEB-INF/*-context.xml"):
* Input patterns have to match the strategy implementation. This interface just
...
...
@@ -42,7 +43,8 @@ import org.springframework.core.io.ResourceLoader;
* <p>This interface also suggests a new resource prefix "classpath*:" for all
* matching resources from the class path. Note that the resource location is
* expected to be a path without placeholders in this case (e.g. "/beans.xml");
* JAR files or classes directories can contain multiple files of the same name.
* JAR files or different directories in the class path can contain multiple files
* of the same name.
*
* @author Juergen Hoeller
* @since 1.0.2
...
...
@@ -55,7 +57,7 @@ public interface ResourcePatternResolver extends ResourceLoader {
/**
* Pseudo URL prefix for all matching resources from the class path: "classpath*:"
* This differs from ResourceLoader's classpath URL prefix in that it
*
<p>
This differs from ResourceLoader's classpath URL prefix in that it
* retrieves all matching resources for a given name (e.g. "/beans.xml"),
* for example in the root of all deployed JAR files.
* @see org.springframework.core.io.ResourceLoader#CLASSPATH_URL_PREFIX
...
...
@@ -63,12 +65,12 @@ public interface ResourcePatternResolver extends ResourceLoader {
String
CLASSPATH_ALL_URL_PREFIX
=
"classpath*:"
;
/**
* Resolve the given location pattern into
Resource
objects.
* Resolve the given location pattern into
{@code Resource}
objects.
* <p>Overlapping resource entries that point to the same physical
* resource should be avoided, as far as possible. The result should
* have set semantics.
* @param locationPattern the location pattern to resolve
* @return the corresponding
Resource
objects
* @return the corresponding
{@code Resource}
objects
* @throws IOException in case of I/O errors
*/
Resource
[]
getResources
(
String
locationPattern
)
throws
IOException
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录