Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
eed1a323
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,发现更多精彩内容 >>
提交
eed1a323
编写于
11月 04, 2013
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing (along with SPR-10992)
上级
935bd25b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
32 deletion
+27
-32
spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
.../java/org/springframework/aop/scope/ScopedProxyUtils.java
+2
-2
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
...k/context/annotation/ConfigurationClassPostProcessor.java
+25
-30
未找到文件。
spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
浏览文件 @
eed1a323
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
3
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.
...
...
@@ -54,7 +54,7 @@ public abstract class ScopedProxyUtils {
// Create a scoped proxy definition for the original bean name,
// "hiding" the target bean in an internal target definition.
RootBeanDefinition
proxyDefinition
=
new
RootBeanDefinition
(
ScopedProxyFactoryBean
.
class
);
proxyDefinition
.
setOriginatingBeanDefinition
(
definition
.
getBeanDefinition
()
);
proxyDefinition
.
setOriginatingBeanDefinition
(
targetDefinition
);
proxyDefinition
.
setSource
(
definition
.
getSource
());
proxyDefinition
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
...
...
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
浏览文件 @
eed1a323
...
...
@@ -27,7 +27,7 @@ import java.util.Set;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.PropertyValues
;
import
org.springframework.beans.factory.BeanClassLoaderAware
;
import
org.springframework.beans.factory.BeanDefinitionStoreException
;
...
...
@@ -90,7 +90,7 @@ import static org.springframework.context.annotation.AnnotationConfigUtils.*;
* @since 3.0
*/
public
class
ConfigurationClassPostProcessor
implements
BeanDefinitionRegistryPostProcessor
,
ResourceLoaderAware
,
BeanClassLoaderAware
,
EnvironmentAware
,
PriorityOrdered
{
PriorityOrdered
,
ResourceLoaderAware
,
BeanClassLoaderAware
,
EnvironmentAware
{
private
static
final
String
IMPORT_AWARE_PROCESSOR_BEAN_NAME
=
ConfigurationClassPostProcessor
.
class
.
getName
()
+
".importAwareProcessor"
;
...
...
@@ -138,6 +138,10 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
};
@Override
public
int
getOrder
()
{
return
Ordered
.
LOWEST_PRECEDENCE
;
// within PriorityOrdered
}
/**
* Set the {@link SourceExtractor} to use for generated bean definitions
...
...
@@ -318,7 +322,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
this
.
importBeanNameGenerator
);
}
reader
.
loadBeanDefinitions
(
parser
.
getConfigurationClasses
());
this
.
reader
.
loadBeanDefinitions
(
parser
.
getConfigurationClasses
());
// Register the ImportRegistry as a bean in order to support ImportAware @Configuration classes
if
(
singletonRegistry
!=
null
)
{
...
...
@@ -374,23 +378,23 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
}
}
@Override
public
int
getOrder
()
{
return
Ordered
.
LOWEST_PRECEDENCE
;
// within PriorityOrdered
}
private
static
class
ImportAwareBeanPostProcessor
implements
PriorityOrdered
,
BeanFactoryAware
,
BeanPostProcessor
{
private
static
class
ImportAwareBeanPostProcessor
implements
BeanPostProcessor
,
PriorityOrdered
,
BeanFactoryAware
{
private
BeanFactory
beanFactory
;
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
int
getOrder
()
{
return
Ordered
.
HIGHEST_PRECEDENCE
;
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
this
.
beanFactory
=
beanFactory
;
}
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
ImportAware
)
{
ImportRegistry
importRegistry
=
this
.
beanFactory
.
getBean
(
IMPORT_REGISTRY_BEAN_NAME
,
ImportRegistry
.
class
);
String
importingClass
=
importRegistry
.
getImportingClassFor
(
bean
.
getClass
().
getSuperclass
().
getName
());
...
...
@@ -413,14 +417,9 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
}
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
return
bean
;
}
@Override
public
int
getOrder
()
{
return
Ordered
.
HIGHEST_PRECEDENCE
;
}
}
...
...
@@ -429,9 +428,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
* {@link EnhancedConfiguration} beans are injected with the {@link BeanFactory}
* before the {@link AutowiredAnnotationBeanPostProcessor} runs (SPR-10668).
*/
private
static
class
EnhancedConfigurationBeanPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapter
implements
PriorityOrdered
,
BeanFactoryAware
{
private
static
class
EnhancedConfigurationBeanPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapter
implements
PriorityOrdered
,
BeanFactoryAware
{
private
BeanFactory
beanFactory
;
...
...
@@ -441,22 +439,19 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
}
@Override
public
PropertyValues
postProcessPropertyValues
(
PropertyValues
pvs
,
PropertyDescriptor
[]
pds
,
Object
bean
,
String
beanName
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
this
.
beanFactory
=
beanFactory
;
}
@Override
public
PropertyValues
postProcessPropertyValues
(
PropertyValues
pvs
,
PropertyDescriptor
[]
pds
,
Object
bean
,
String
beanName
)
{
// Inject the BeanFactory before AutowiredAnnotationBeanPostProcessor's
// postProcessPropertyValues method attempts to auto-wire other configuration
// beans.
// postProcessPropertyValues method attempts to auto-wire other configuration beans.
if
(
bean
instanceof
EnhancedConfiguration
)
{
((
EnhancedConfiguration
)
bean
).
setBeanFactory
(
this
.
beanFactory
);
}
return
pvs
;
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
this
.
beanFactory
=
beanFactory
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录