Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
bd282e63
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
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,发现更多精彩内容 >>
提交
bd282e63
编写于
12月 20, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
(cherry picked from commit
6e5b8736
)
上级
6bdc5bfc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
30 deletion
+36
-30
spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java
...ringframework/context/ConfigurableApplicationContext.java
+6
-0
spring-core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java
...org/springframework/core/env/ConfigurableEnvironment.java
+11
-12
spring-core/src/main/java/org/springframework/core/env/Environment.java
...c/main/java/org/springframework/core/env/Environment.java
+3
-3
spring-oxm/src/main/java/org/springframework/oxm/xstream/CatchAllConverter.java
...va/org/springframework/oxm/xstream/CatchAllConverter.java
+16
-15
未找到文件。
spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java
浏览文件 @
bd282e63
...
...
@@ -53,6 +53,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* Name of the ConversionService bean in the factory.
* If none is supplied, default conversion rules apply.
* @see org.springframework.core.convert.ConversionService
* @since 3.0
*/
String
CONVERSION_SERVICE_BEAN_NAME
=
"conversionService"
;
...
...
@@ -60,12 +61,14 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* Name of the LoadTimeWeaver bean in the factory. If such a bean is supplied,
* the context will use a temporary ClassLoader for type matching, in order
* to allow the LoadTimeWeaver to process all actual bean classes.
* @since 2.5
* @see org.springframework.instrument.classloading.LoadTimeWeaver
*/
String
LOAD_TIME_WEAVER_BEAN_NAME
=
"loadTimeWeaver"
;
/**
* Name of the {@link Environment} bean in the factory.
* @since 3.1
*/
String
ENVIRONMENT_BEAN_NAME
=
"environment"
;
...
...
@@ -84,6 +87,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/**
* Set the unique id of this application context.
* @since 3.0
*/
void
setId
(
String
id
);
...
...
@@ -99,12 +103,14 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/**
* Return the Environment for this application context in configurable form.
* @since 3.1
*/
ConfigurableEnvironment
getEnvironment
();
/**
* Set the {@code Environment} for this application context.
* @param environment the new environment
* @since 3.1
*/
void
setEnvironment
(
ConfigurableEnvironment
environment
);
...
...
spring-core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java
浏览文件 @
bd282e63
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -35,24 +35,24 @@ import java.util.Map;
*
* <h4>Example: adding a new property source with highest search priority</h4>
* <pre class="code">
*
ConfigurableEnvironment environment = new StandardEnvironment();
*
MutablePropertySources propertySources = environment.getPropertySources();
*
Map<String, String> myMap = new HashMap<String, String>();
*
myMap.put("xyz", "myValue");
*
propertySources.addFirst(new MapPropertySource("MY_MAP", myMap));
* ConfigurableEnvironment environment = new StandardEnvironment();
* MutablePropertySources propertySources = environment.getPropertySources();
* Map<String, String> myMap = new HashMap<String, String>();
* myMap.put("xyz", "myValue");
* propertySources.addFirst(new MapPropertySource("MY_MAP", myMap));
* </pre>
*
* <h4>Example: removing the default system properties property source</h4>
* <pre class="code">
*
MutablePropertySources propertySources = environment.getPropertySources();
*
propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
* MutablePropertySources propertySources = environment.getPropertySources();
* propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
* </pre>
*
* <h4>Example: mocking the system environment for testing purposes</h4>
* <pre class="code">
*
MutablePropertySources propertySources = environment.getPropertySources();
*
MockPropertySource mockEnvVars = new MockPropertySource().withProperty("xyz", "myValue");
*
propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
* MutablePropertySources propertySources = environment.getPropertySources();
* MockPropertySource mockEnvVars = new MockPropertySource().withProperty("xyz", "myValue");
* propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
* </pre>
*
* When an {@link Environment} is being used by an {@code ApplicationContext}, it is
...
...
@@ -64,7 +64,6 @@ import java.util.Map;
* org.springframework.context.support.PropertySourcesPlaceholderConfigurer property
* placeholder configurers}.
*
*
* @author Chris Beams
* @since 3.1
* @see StandardEnvironment
...
...
spring-core/src/main/java/org/springframework/core/env/Environment.java
浏览文件 @
bd282e63
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -77,8 +77,8 @@ public interface Environment extends PropertyResolver {
* activated by setting {@linkplain AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
* "spring.profiles.active"} as a system property or by calling
* {@link ConfigurableEnvironment#setActiveProfiles(String...)}.
* <p>If no profiles have explicitly been specified as active, then any
{@linkplain
* #getDefaultProfiles() default profiles} will automatically be activated.
* <p>If no profiles have explicitly been specified as active, then any
*
{@linkplain
#getDefaultProfiles() default profiles} will automatically be activated.
* @see #getDefaultProfiles
* @see ConfigurableEnvironment#setActiveProfiles
* @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
...
...
spring-oxm/src/main/java/org/springframework/oxm/xstream/CatchAllConverter.java
浏览文件 @
bd282e63
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -25,23 +25,25 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
/**
* XStream {@link Converter} that supports all classes, but throws exceptions for
* (un)marshalling.
* <p>Main purpose of this class is to
*
* <p>The main purpose of this class is to
* {@linkplain com.thoughtworks.xstream.XStream#registerConverter(com.thoughtworks.xstream.converters.Converter, int) register}
* this converter as a catchall last converter with a
* this converter as a catch
-
all last converter with a
* {@linkplain com.thoughtworks.xstream.XStream#PRIORITY_NORMAL normal}
* or higher priority, in addition to converters that explicitly support the domain
* classes that should be supported. As a result, default XStream converters with lower
* priorities and possible security vulnerabilities do not get invoked.
* <p>For instance:</p>
* or higher priority, in addition to converters that explicitly handle the domain
* classes that should be supported. As a result, default XStream converters with
* lower priorities and possible security vulnerabilities do not get invoked.
*
* <p>For instance:
* <pre class="code">
* XStreamMarshaller unmarshaller = new XStreamMarshaller();
* unmarshaller.getXStream().registerConverter(new MyDomainClassConverter(), XStream.PRIORITY_VERY_HIGH);
* unmarshaller.getXStream().registerConverter(new CatchAllConverter(), XStream.PRIORITY_NORMAL);
* MyDomainClass
o
= unmarshaller.unmarshal(source);
* MyDomainClass
myObject
= unmarshaller.unmarshal(source);
* </pre
*
* @author Arjen Poutsma
* @since
4.0
* @since
3.2.5
*/
public
class
CatchAllConverter
implements
Converter
{
...
...
@@ -51,14 +53,13 @@ public class CatchAllConverter implements Converter {
}
@Override
public
void
marshal
(
Object
source
,
HierarchicalStreamWriter
writer
,
MarshallingContext
context
)
{
throw
new
UnsupportedOperationException
(
"marshalling not supported"
);
public
void
marshal
(
Object
source
,
HierarchicalStreamWriter
writer
,
MarshallingContext
context
)
{
throw
new
UnsupportedOperationException
(
"Marshalling not supported"
);
}
@Override
public
Object
unmarshal
(
HierarchicalStreamReader
reader
,
UnmarshallingContext
context
)
{
throw
new
UnsupportedOperationException
(
"unmarshalling not supported"
);
public
Object
unmarshal
(
HierarchicalStreamReader
reader
,
UnmarshallingContext
context
)
{
throw
new
UnsupportedOperationException
(
"Unmarshalling not supported"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录