有没有办法让Hibernate Envers运行
在调用保存或更新而不是在事务结束时继续?
我有一个
@Transactional
我的注解(有效的端到端测试)。因为代码不包含测试方法,所以我无法在其中放入“flush”或任何东西(除了编辑非测试代码,这不是我们的愿望)。
我不知道如何让Envers日志处理这些电话。我需要它来工作,因为我正在使用Envers审计表在运行时检查旧条目,并希望为这个功能创建测试用例。
我有以下单元测试代码:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration("/src/webapp")
@EnableWebMvc
@Transactional
@TestPropertySource(locations= {"classpath:/config/common.properties"}, properties = {"..."})
@ContextConfiguration(locations = {"..."})
public class Test {
@Autowired
private WebApplicationContext wac;
@Autowired
private UserDetailsService detailsService;
private MockMvc mockMvc;
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac)
.build();
}
...
}