java application缓存_java – 没有缓存Spring ApplicationContext用于与Maven的集成测试

当集成测试从IDE启动时,ApllicationContext只加载一次,然后在测试之间共享,并且它按预期工作.但执行mvn clean install每次测试都会创建新的ApllicationContext.根据Spring doc我配置了

maven-failsafe-plugin使用单叉

要缓存ApplicationContext,请使用以下注释:

@ContextConfiguration(classes = TestConfig.class)

使用maven构建应用程序时为什么不共享上下文?

实际上有没有其他方式加速IT测试?谢谢.

更新:

这是多模Maven项目. Accordig Spring IT caching doc

To benefit from the caching mechanism,all tests must run within the

same process or test suite. This can be achieved by executing all

tests as a group within an IDE. Similarly,when executing tests with a

build framework such as Ant,Maven,or Gradle it is important to make

sure that the build framework does not fork between tests. For

example,if the forkMode for the Maven Surefire plug-in is set to

always or pertest,the TestContext framework will not be able to cache

application contexts between test classes and the build process will

run significantly slower as a result.

所以对于maven-failsafe-plugin 2.14,这个配置等于forkMode =一次

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值