Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
spring-framework
提交
0756a6ab
S
spring-framework
项目概览
dk131072
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
0756a6ab
编写于
5月 25, 2011
作者:
C
Chris Beams
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish PropertySource and Environment Javadoc
上级
37d955b3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
22 deletion
+37
-22
org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java
...org/springframework/context/annotation/Configuration.java
+2
-1
org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java
...rg/springframework/context/annotation/PropertySource.java
+12
-9
org.springframework.core/src/main/java/org/springframework/core/env/PropertySource.java
...ain/java/org/springframework/core/env/PropertySource.java
+19
-11
org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java
...ava/org/springframework/core/env/StandardEnvironment.java
+2
-1
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/StandardPortletEnvironment.java
...ework/web/portlet/context/StandardPortletEnvironment.java
+1
-0
org.springframework.web/src/main/java/org/springframework/web/context/support/StandardServletEnvironment.java
...ework/web/context/support/StandardServletEnvironment.java
+1
-0
未找到文件。
org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java
浏览文件 @
0756a6ab
...
...
@@ -98,7 +98,8 @@ import org.springframework.stereotype.Component;
* <h3>Using the {@code Environment} API</h3>
* Externalized values may be looked up by injecting the Spring
* {@link org.springframework.core.env.Environment Environment} into a
* {@code @Configuration} class:
* {@code @Configuration} class using the {@code @Autowired} or the {@code @Inject}
* annotation:
* <pre class="code">
* @Configuration
* public class AppConfig {
...
...
org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java
浏览文件 @
0756a6ab
...
...
@@ -49,10 +49,10 @@ import java.lang.annotation.Target;
* }
* }</pre>
*
* Notice that the {@code Environment} object is @{@link
Autowired} into the
*
configuration class and then used when populating the {@code TestBean}
*
object. Given the configuration above, a call to {@code testBean.getName()} will
* return "myTestBean".
* Notice that the {@code Environment} object is @{@link
*
org.springframework.beans.factory.annotation.Autowired Autowired} into the
*
configuration class and then used when populating the {@code TestBean} object. Given
*
the configuration above, a call to {@code testBean.getName()} will
return "myTestBean".
*
* <h3>A note on property overriding with @PropertySource</h3>
* In cases where a given property key exists in more than one {@code .properties}
...
...
@@ -91,13 +91,16 @@ import java.lang.annotation.Target;
* if the {@code @Configuration} classes above were registered via component-scanning,
* the ordering is difficult to predict. In such cases - and if overriding is important -
* it is recommended that the user fall back to using the programmatic PropertySource API.
* See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment} and
* {@link org.springframework.core.env.MutablePropertySources MutablePropertySources} Javadoc
* for details.
* See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment}
* and * {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}
* Javadoc for details.
*
* @author Chris Beams
* @since 3.1
* @see Configuration
* @see org.springframework.core.env.PropertySource
* @see org.springframework.core.env.ConfigurableEnvironment#getPropertySources()
* @see org.springframework.core.env.MutablePropertySources
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
...
...
@@ -105,7 +108,7 @@ import java.lang.annotation.Target;
public
@interface
PropertySource
{
/**
* Indicate the name of this
PropertyS
ource. If omitted, a name
* Indicate the name of this
property s
ource. If omitted, a name
* will be generated based on the description of the underlying
* resource.
* @see org.springframework.core.env.PropertySource#getName()
...
...
org.springframework.core/src/main/java/org/springframework/core/env/PropertySource.java
浏览文件 @
0756a6ab
...
...
@@ -24,19 +24,26 @@ import org.springframework.util.Assert;
* Abstract base class representing a source of key/value property pairs. The underlying
* {@linkplain #getSource() source object} may be of any type {@code T} that encapsulates
* properties. Examples include {@link java.util.Properties} objects, {@link java.util.Map}
* objects, {@code ServletContext} and {@code ServletConfig} objects (for access to init parameters).
* Explore the {@code PropertySource} type hierarchy to see provided implementations.
* objects, {@code ServletContext} and {@code ServletConfig} objects (for access to init
* parameters). Explore the {@code PropertySource} type hierarchy to see provided
* implementations.
*
* <p>{@code PropertySource} objects are not typically used in isolation, but rather
through a
*
{@link PropertySources} object, which aggregates property sources and in conjunction with
*
a {@link PropertyResolver} implementation that can perform precedence-based searches across
* the set of {@code PropertySources}.
* <p>{@code PropertySource} objects are not typically used in isolation, but rather
*
through a {@link PropertySources} object, which aggregates property sources and in
*
conjunction with a {@link PropertyResolver} implementation that can perform
*
precedence-based searches across
the set of {@code PropertySources}.
*
* <p>{@code PropertySource} identity is determined not based on the content of encapsulated
* properties, but rather based on the {@link #getName() name} of the {@code PropertySource}
* alone. This is useful for manipulating {@code PropertySource} objects when in collection
* contexts. See operations in {@link MutablePropertySources} as well as the
* {@link #named(String)} and {@link #toString()} methods for details.
* <p>{@code PropertySource} identity is determined not based on the content of
* encapsulated properties, but rather based on the {@link #getName() name} of the
* {@code PropertySource} alone. This is useful for manipulating {@code PropertySource}
* objects when in collection contexts. See operations in {@link MutablePropertySources}
* as well as the {@link #named(String)} and {@link #toString()} methods for details.
*
* <p>Note that when working with @{@link
* org.springframework.context.annotation.Configuration Configuration} classes that
* the @{@link org.springframework.context.annotation.PropertySource PropertySource}
* annotation provides a convenient and declarative way of adding property sources to the
* enclosing {@code Environment}.
*
* @author Chris Beams
* @since 3.1
...
...
@@ -44,6 +51,7 @@ import org.springframework.util.Assert;
* @see PropertyResolver
* @see PropertySourcesPropertyResolver
* @see MutablePropertySources
* @see org.springframework.context.annotation.PropertySource
*/
public
abstract
class
PropertySource
<
T
>
{
...
...
org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java
浏览文件 @
0756a6ab
...
...
@@ -67,7 +67,7 @@ package org.springframework.core.env;
* {@link org.springframework.context.support.AbstractApplicationContext#refresh()
* refresh()} method is called. This ensures that all PropertySources are available during
* the container bootstrap process, including use by
* {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* {@link
plain
org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* property placeholder configurers}.
*
* @author Chris Beams
...
...
@@ -93,6 +93,7 @@ public class StandardEnvironment extends AbstractEnvironment {
* </ul>
* <p>Properties present in {@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME} will
* take precedence over those in {@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}.
* @see AbstractEnvironment#customizePropertySources(MutablePropertySources)
* @see #getSystemProperties()
* @see #getSystemEnvironment()
*/
...
...
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/StandardPortletEnvironment.java
浏览文件 @
0756a6ab
...
...
@@ -68,6 +68,7 @@ public class StandardPortletEnvironment extends StandardEnvironment {
* initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
* {@link ServletContext} objects are available.
* @see StandardEnvironment#customizePropertySources
* @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see PortletConfigPropertySource
* @see PortletContextPropertySource
* @see AbstractRefreshablePortletApplicationContext#initPropertySources
...
...
org.springframework.web/src/main/java/org/springframework/web/context/support/StandardServletEnvironment.java
浏览文件 @
0756a6ab
...
...
@@ -77,6 +77,7 @@ public class StandardServletEnvironment extends StandardEnvironment {
* servlet property sources, but higher than system properties and environment
* variables.
* @see StandardEnvironment#customizePropertySources
* @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see ServletConfigPropertySource
* @see ServletContextPropertySource
* @see org.springframework.jndi.JndiPropertySource
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录