Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
0b2592a7
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,发现更多精彩内容 >>
提交
0b2592a7
编写于
9月 29, 2011
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPR-8240] polishing
上级
5db7cca9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
16 deletion
+17
-16
spring-framework-reference/src/testing.xml
spring-framework-reference/src/testing.xml
+17
-16
未找到文件。
spring-framework-reference/src/testing.xml
浏览文件 @
0b2592a7
...
...
@@ -1062,16 +1062,13 @@ public void testProcessRepeatedly() {
<title>
Context management and caching
</title>
<para>
Each
<classname>
TestContext
</classname>
provides context
management and caching support for the test instance
for which it is
responsible
. Test instances do not automatically receive access to the
management and caching support for the test instance
it is responsible
for
. Test instances do not automatically receive access to the
configured
<classname>
ApplicationContext
</classname>
. However, if a
test class implements the
<interfacename>
ApplicationContextAware
</interfacename>
interface, a
reference to the
<classname>
ApplicationContext
</classname>
is supplied
to the test instance. Note that dependency injection support is
provided by the
<classname>
DependencyInjectionTestExecutionListener
</classname>
which
is configured by default. In addition,
to the test instance. Note that
<classname>
AbstractJUnit4SpringContextTests
</classname>
and
<classname>
AbstractTestNGSpringContextTests
</classname>
implement
<interfacename>
ApplicationContextAware
</interfacename>
and therefore
...
...
@@ -1096,6 +1093,11 @@ public class MyTest {
<lineannotation>
// class body...
</lineannotation>
}
</programlisting>
<para>
Note that support for dependency injection via
<interfacename>
@Autowired
</interfacename>
is provided by the
<classname>
DependencyInjectionTestExecutionListener
</classname>
which is configured by default.
</para>
</tip>
<para>
In contrast to the deprecated JUnit 3.8 legacy class hierarchy,
...
...
@@ -1189,11 +1191,11 @@ public class MyTest {
<para>
To load an
<interfacename>
ApplicationContext
</interfacename>
for your tests from
<interfacename>
@Configuration
</interfacename>
classes
, annotate your test class with
<interfacename>
@ContextConfiguration
</interfacename>
and configure
the
<literal>
classes
</literal>
attribute with an array that contains
class references to configuration classes. Alternatively, you can
implement and configure your own custom
classes
(see
<xref
linkend=
"beans-java"
/>
), annotate your test
class with
<interfacename>
@ContextConfiguration
</interfacename>
and
configure the
<literal>
classes
</literal>
attribute with an array
that contains class references to configuration classes.
Alternatively, you can
implement and configure your own custom
<interfacename>
ContextLoader
</interfacename>
or
<interfacename>
SmartContextLoader
</interfacename>
for advanced use
cases.
</para>
...
...
@@ -1212,10 +1214,9 @@ public class MyTest {
<classname>
AnnotationConfigContextLoader
</classname>
will detect all
static inner classes of the annotated test class that meet the
requirements for configuration class implementations as specified in
the Javadoc for
<interfacename>
@Configuration
</interfacename>
(see
<xref
linkend=
"beans-java"
/>
for further details). In the following
example, the
<classname>
OrderServiceTest
</classname>
class declares
a static inner configuration class named
the Javadoc for
<interfacename>
@Configuration
</interfacename>
. In
the following example, the
<classname>
OrderServiceTest
</classname>
class declares a static inner configuration class named
<classname>
Config
</classname>
that will be automatically used to
load the
<interfacename>
ApplicationContext
</interfacename>
for the
test class. Note that the name of the configuration class is
...
...
@@ -1362,7 +1363,7 @@ public class ExtendedTest extends BaseTest {
setter injection, field injection, or both, depending on which
annotations you choose and whether you place them on setter methods or
fields. For consistency with the annotation support introduced in
Spring 3.0, you can use Spring's
Spring
2.5 and
3.0, you can use Spring's
<interfacename>
@Autowired
</interfacename>
annotation or the
<interfacename>
@Inject
</interfacename>
annotation from JSR 300.
</para>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录