Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
a07da0d9
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,发现更多精彩内容 >>
提交
a07da0d9
编写于
8月 26, 2009
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPR-6043] @NotTransactional is now deprecated
上级
eb5d47c6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
21 deletion
+38
-21
build-spring-framework/resources/changelog.txt
build-spring-framework/resources/changelog.txt
+5
-4
org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java
...org/springframework/test/annotation/NotTransactional.java
+9
-2
spring-framework-reference/src/testing.xml
spring-framework-reference/src/testing.xml
+24
-15
未找到文件。
build-spring-framework/resources/changelog.txt
浏览文件 @
a07da0d9
...
...
@@ -3,15 +3,16 @@ SPRING FRAMEWORK CHANGELOG
http://www.springsource.org
Changes in version 3.0.0.RC1 (2009
Q3
)
--------------------------------------
Changes in version 3.0.0.RC1 (2009
-09-XX
)
--------------------------------------
---
* upgraded to JUnit 4.7 and TestNG 5.10
* SpringJUnit4ClassRunner is now compatible with JUnit 4.5 - 4.7
* SpringJUnit4ClassRunner is now compatible with JUnit 4.5, 4.6, and 4.7
* @NotTransactional is now deprecated
Changes in version 3.0.0.M4 (2009-08-10)
----------------------------------------
-
----------------------------------------
* upgraded to JUnit 4.6, TestNG 5.9, and EasyMock 2.5.1
* updated all Spring Framework OSGI manifests to list unversioned imports explicitly
...
...
org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java
浏览文件 @
a07da0d9
/*
* Copyright 2002-200
7
the original author or authors.
* Copyright 2002-200
9
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.
...
...
@@ -23,14 +23,21 @@ import java.lang.annotation.RetentionPolicy;
import
java.lang.annotation.Target
;
/**
* Test annotation to indicate that a method is
not transactional
.
* Test annotation to indicate that a method is
<i>not transactional</i>
.
*
* @author Rod Johnson
* @author Sam Brannen
* @since 2.0
* @deprecated as of Spring 3.0, in favor of moving the non-transactional test
* method to a separate (non-transactional) test class or to a
* {@link org.springframework.test.context.transaction.BeforeTransaction
* @BeforeTransaction} or
* {@link org.springframework.test.context.transaction.AfterTransaction
* @AfterTransaction} method.
*/
@Documented
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
METHOD
)
@Deprecated
public
@interface
NotTransactional
{
}
spring-framework-reference/src/testing.xml
浏览文件 @
a07da0d9
...
...
@@ -181,7 +181,7 @@
use, thus allowing instrumentation of tests in various environments
including JUnit, TestNG, etc.
</para>
<
note
>
<
warning
>
<title>
Legacy JUnit 3.8 class hierarchy is deprecated
</title>
<para>
As of Spring 3.0, the legacy JUnit 3.8 base class hierarchy
...
...
@@ -192,7 +192,7 @@
Thus any code which depends on the legacy JUnit 3.8 support should be
migrated to the
<link
linkend=
"testcontext-framework"
>
Spring
TestContext Framework
</link>
.
</para>
</
note
>
</
warning
>
</section>
<section
id=
"integration-testing-goals"
>
...
...
@@ -613,6 +613,23 @@ public void afterTransaction() {
public void testProcessWithoutTransaction() {
<lineannotation>
// ...
</lineannotation>
}
</programlisting>
<warning>
<title>
@NotTransactional is deprecated
</title>
<para>
As of Spring 3.0,
<interfacename>
@NotTransactional
</interfacename>
is deprecated in favor of moving the
<emphasis>
non-transactional
</emphasis>
test
method to a separate (non-transactional) test class or to a
<interfacename>
@BeforeTransaction
</interfacename>
or
<interfacename>
@AfterTransaction
</interfacename>
method.
As an alternative to annotating an entire class with
<interfacename>
@Transactional
</interfacename>
consider
annotating individual methods with
<interfacename>
@Transactional
</interfacename>
;
doing so allows a mix of transactional and non-transactional
methods in the same test class without the need for
using
<interfacename>
@NotTransactional
</interfacename>
.
</para>
</warning>
</listitem>
</itemizedlist>
...
...
@@ -1318,14 +1335,9 @@ public final class HibernateTitleDaoTests {
in the
<link
linkend=
"integration-testing-annotations"
>
annotation
support
</link>
section.
</para>
<para>
There are several options for configuring transactions for
individual test methods. If transactions are not enabled for the
<para>
If transactions are not enabled for the
entire test class, methods may be explicitly annotated with
<interfacename>
@Transactional
</interfacename>
. Similarly, if
transactions
<emphasis>
are
</emphasis>
enabled for the entire test
class, methods may be explicitly flagged not to run within a
transaction by annotating them with
<interfacename>
@NotTransactional
</interfacename>
. To control whether
<interfacename>
@Transactional
</interfacename>
. To control whether
or not a transaction should commit for a particular test method, you
may use the
<interfacename>
@Rollback
</interfacename>
annotation to
override the class-level default rollback setting.
</para>
...
...
@@ -1364,7 +1376,9 @@ public final class HibernateTitleDaoTests {
<interfacename>
@BeforeTransaction
</interfacename>
or
<interfacename>
@AfterTransaction
</interfacename>
will naturally not
be executed for tests annotated with
<interfacename>
@NotTransactional
</interfacename>
.
</para>
<interfacename>
@NotTransactional
</interfacename>
. Note, however,
that
<interfacename>
@NotTransactional
</interfacename>
is
deprecated as of Spring 3.0.
</para>
</tip>
<para>
The following JUnit 4 based example displays a fictitious
...
...
@@ -1407,11 +1421,6 @@ public class FictitiousTransactionalTest {
<lineannotation>
// logic to verify the final state after transaction has rolled back
</lineannotation>
}
@Test
<emphasis
role=
"bold"
>
@NotTransactional
</emphasis>
public void performNonDatabaseRelatedAction() {
<lineannotation>
// logic which does not modify database state
</lineannotation>
}
}
</programlisting>
<note>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录