Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
ae1205a5
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,发现更多精彩内容 >>
提交
ae1205a5
编写于
9月 30, 2011
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPR-8240] polishing
上级
5e1d6b9a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
14 deletion
+14
-14
spring-framework-reference/src/testing.xml
spring-framework-reference/src/testing.xml
+14
-14
未找到文件。
spring-framework-reference/src/testing.xml
浏览文件 @
ae1205a5
...
...
@@ -1094,17 +1094,17 @@ public class MyTest {
<lineannotation>
// class body...
</lineannotation>
}
</programlisting>
<para>
Note that support for d
ependency injection via
<para>
D
ependency injection via
<interfacename>
@Autowired
</interfacename>
is provided by the
<classname>
DependencyInjectionTestExecutionListener
</classname>
which is configured by default.
</para>
which is configured by default (see
<xref
linkend=
"testcontext-fixture-di"
/>
).
</para>
</tip>
<para>
In contrast to the deprecated JUnit 3.8 legacy class hierarchy,
test classes that use the TestContext framework do not need to
override any
<literal>
protected
</literal>
instance methods to
<para>
Test classes that use the TestContext framework do not need to
extend any particular class or implement a specific interface to
configure their application context. Instead, configuration is
achieved
mere
ly by declaring the
achieved
simp
ly by declaring the
<interfacename>
@ContextConfiguration
</interfacename>
annotation at the
class level. If your test class does not explicitly declare
application context resource
<literal>
locations
</literal>
or
...
...
@@ -1113,7 +1113,7 @@ public class MyTest {
context from a default location or default configuration
classes.
</para>
<para>
The following sections explain how to configure an
d manage an
<para>
The following sections explain how to configure an
<interfacename>
ApplicationContext
</interfacename>
via XML
configuration files or
<interfacename>
@Configuration
</interfacename>
classes using Spring's
...
...
@@ -1121,10 +1121,10 @@ public class MyTest {
annotation.
</para>
<section
id=
"testcontext-ctx-management-xml"
>
<title>
Context
management
with XML resources
</title>
<title>
Context
configuration
with XML resources
</title>
<para>
To load an
<interfacename>
ApplicationContext
</interfacename>
for your tests
from
XML configuration files, annotate your test
for your tests
using
XML configuration files, annotate your test
class with
<interfacename>
@ContextConfiguration
</interfacename>
and
configure the
<literal>
locations
</literal>
attribute with an array
that contains the resource locations of XML configuration metadata.
...
...
@@ -1187,15 +1187,15 @@ public class MyTest {
</section>
<section
id=
"testcontext-ctx-management-javaconfig"
>
<title>
Context
management
with @Configuration classes
</title>
<title>
Context
configuration
with @Configuration classes
</title>
<para>
To load an
<interfacename>
ApplicationContext
</interfacename>
for your tests
from
<interfacename>
@Configuration
</interfacename>
for your tests
using
<interfacename>
@Configuration
</interfacename>
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
that contains
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>
...
...
@@ -1352,7 +1352,7 @@ public class ExtendedTest extends BaseTest {
</section>
<section
id=
"testcontext-fixture-di"
>
<title>
Dependency
I
njection of test fixtures
</title>
<title>
Dependency
i
njection of test fixtures
</title>
<para>
When you use the
<classname>
DependencyInjectionTestExecutionListener
</classname>
—
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录