springboot单元测试自动回滚:@Transactional
2019-04-21 12:23:14.509 INFO 9384 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-04-21 12:23:14.818 INFO 9384 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-04-21 12:23:14.829 INFO 9384 --- [ main] o.s.t.c.transaction.TransactionContext : Began transaction (1) for test context [DefaultTestContext@7e0b85f9 testClass = ReportHistoryRecordsServiceTest, testInstance = com.demo.service.ReportHistoryRecordsServiceTest@f6de586, testMethod = testSave@ReportHistoryRecordsServiceTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@63355449 testClass = ReportHistoryRecordsServiceTest, locations = '{}', classes = '{class com.demo.DemoApplication, class com.demo.DemoApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@33f88ab, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@1b68ddbd, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2f943d71, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@1a1d6a08], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]; transaction manager [org.springframework.jdbc.datasource.DataSourceTransactionManager@5f2bd6d9]; rollback [true]
2019-04-21 12:23:15.334 DEBUG 9384 --- [ main] c.d.d.ReportHistoryRecordsMapper.insert : ==> Preparing: INSERT INTO report_history_records ( id,created_at,created_by,updated_at,updated_by,sn,name,phone_num,content ) VALUES( ?,?,?,?,?,?,?,?,? )
2019-04-21 12:23:15.380 DEBUG 9384 --- [ main] c.d.d.ReportHistoryRecordsMapper.insert : ==> Parameters: null, 2019-04-21 12:23:15.246(Timestamp), sys(String), 2019-04-21 12:23:15.246(Timestamp), sys(String), fw12a5ca4s441s5r5(String), 张三(String), 12345678(String), 发现冒牌举报,休息休息吧!(String)
2019-04-21 12:23:15.382 DEBUG 9384 --- [ main] c.d.d.ReportHistoryRecordsMapper.insert : <== Updates: 1
2019-04-21 12:23:15.402 DEBUG 9384 --- [ main] c.d.d.R.insert!selectKey : ==> Executing: SELECT LAST_INSERT_ID()
2019-04-21 12:23:15.436 DEBUG 9384 --- [ main] c.d.d.R.insert!selectKey : <== Total: 1
2019-04-21 12:23:15.445 INFO 9384 --- [ main] o.s.t.c.transaction.TransactionContext : Rolled back transaction for test: [DefaultTestContext@7e0b85f9 testClass = ReportHistoryRecordsServiceTest, testInstance = com.demo.service.ReportHistoryRecordsServiceTest@f6de586, testMethod = testSave@ReportHistoryRecordsServiceTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@63355449 testClass = ReportHistoryRecordsServiceTest, locations = '{}', classes = '{class com.demo.DemoApplication, class com.demo.DemoApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@33f88ab, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@1b68ddbd, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2f943d71, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@1a1d6a08], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]
2019-04-21 12:23:15.455 INFO 9384 --- [ Thread-2] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2019-04-21 12:23:15.458 INFO 9384 --- [ Thread-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-04-21 12:23:15.471 INFO 9384 --- [ Thread-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
springboot单元测试自动回滚:@Transactional的更多相关文章
- flask-sqlalchemy、pytest 的单元测试和事务自动回滚
flask-sqlalchemy.pytest 的单元测试和事务自动回滚 使用 flask-sqlalchemy 做数据库时,单元测试可以帮助发现一些可能意想不到的问题,像 delete-cascad ...
- MockMvc 进行 controller层单元测试 事务自动回滚 完整实例
package com.ieou.ms_backend.controller; import com.google.gson.Gson; import com.ieou.ms_backend.dto. ...
- Spring事务为什么不会自动回滚?Spring事务怎样才会自动回滚?事务自动回滚条件及手动回滚
原文:https://blog.csdn.net/qq_32331073/article/details/76508147 更多Spring事务问题请访问链接:Spring事务回滚问题疑难详解 在此, ...
- 【linux】【jenkins】jenkins构建、mvn或者npm打包、docker运行、失败自动回滚脚本
小白对jenkins运维的使用有点简单的想法,这里开个记录贴记录下. 由于未找到jenkins构建失败后执行其他脚本的插件,也暂时没有使用其他运维工具.所以想自己写一个shell脚本,一是方便其他人使 ...
- spring事务什么时候会自动回滚
在java中异常的基类为Throwable,他有两个子类xception与Errors.同时RuntimeException就是Exception的子类,只有RuntimeException才会进行回 ...
- 面试突击86:SpringBoot 事务不回滚?怎么解决?
在 Spring Boot 中,造成事务不自动回滚的场景有很多,比如以下这些: 非 public 修饰的方法中的事务不自动回滚: 当 @Transactional 遇上 try/catch 事务不自动 ...
- DDL, DML不是所有SQL都是可以自动回滚的
因为DDL没有事务性,所以DDL不能回滚. 要实现自动回滚.(begin,commit,rollback),则SQL语句中只能包括DML. 这样,自动化发布就会受限规范格式. 故而,一刀切的办法是,假 ...
- mysql 事务中如果有sql语句出错,会导致自动回滚吗?
事务,我们都知道具有原子性,操作要么全部成功,要么全部失败.但是有可能会造成误解. 我们先准备一张表,来进行测试 CREATE TABLE `name` ( `id` int(11) unsigned ...
- spring 在service中需要抛出异常才能自动回滚
在spring 事务配置中,如果service方法捕获了异常,则程序报错也不会自动回滚, 1.手动开启关闭事务 2.抛出异常,可以先捕获异常,然后自定义runtime异常,可不用声明
随机推荐
- 关于CC的完全非线性椭圆方程一书的一些小结
CC的整本书主要是想要研究在粘性解的框架下的一致椭圆方程解的正则性.我们试着一章一章来解析他. 序言部分也是值得每一个字细读的,主要讲述了他们的工作的主要内容,即在粘性解的框架下研究解的正则性,需要特 ...
- C#通过读取Mysql脚本创建数据库
#region script helper private bool ExecuteScriptFile(string pathToScriptFile, out string errorMsg) { ...
- Bootstrap4 导航栏
Bootstrap4 导航栏 目录 Bootstrap4 导航栏 动态选项卡 标准的导航栏 导航对齐方式 导航栏的组成 ul 元素中包含navbar-nav 类 表示导航栏中ul li元素中包含nav ...
- 'JetEntityFrameworkProvider' could not be loaded 解决办法
原因:JetEntityFrameworkProvider引用的EntityFramework与你使用的版本不一致,造成程序加载这个DLL失败. 解决办法: 使用Reflect软件JetEntityF ...
- Hadoop 2.7.4 HDFS+YRAN HA增加datanode和nodemanager
当前集群 主机名称 IP地址 角色 统一安装目录 统一安装用户 sht-sgmhadoopnn-01 172.16.101.55 namenode,resourcemanager /usr/local ...
- Html+css学习笔记一 创建一个网页
第一个网页 新建一个记事本,把名字改成first.html <html> <head> <title>MyFristHtml</title> </ ...
- Linq 27个常用操作符说明
1.Where 操作符用于限定输入集合中的元素,将符合条件的元素组织声称一个序列结果.2.Select 操作符用于根据输入序列中的元素创建相应的输出序列中的元素,输出序列中的元素类型可以与输入序列中 ...
- redis学习——redis应用场景
毫无疑问,Redis开创了一种新的数据存储思路,使用Redis,我们不用在面对功能单调的数据库时,把精力放在如何把大象放进冰箱这样的问题上,而是利用Redis灵活多变的数据结构和数据操作,为不同的大象 ...
- 'Tensorboard.util' has no attribute 'Retrier' - 'Tensorboard.util'没有属性'Retrier'
Here is a popular issue when you want to use tensorbard with your upgraded tensorflow and tensorboar ...
- Django REST framework--序列化
Django REST framework--序列化 基础准备工作 创建项目添加应用 (venv) lee@lee:~/PycharmProjects/Djdemo/djdemo$ python ma ...