@RunWith(SpringRunner.class)
@SpringBootTest(classes=Application.class)
public class MyTest {
@Autowired AppsRepo appRepo;
@Autowired OrdersRepo ordersRepo;
@Test
public void doTest() {
System.out.println("hello world");
}
}
@SpringBootApplication
@ComponentScan
public class Application {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
我有非常简单的集成测试,hibernate和postgresql数据库。只有2个存储库和1个控制器。运行此集成测试大约需要62秒。引擎盖下发生了什么?
我只有2个域对象,只有2个存储库。有没有办法加快测试?看起来大部分时间都是由hibernate
完成的 从那里开始花费了40秒 -2016-11-18 15:58:52.264 INFO 8424 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL92Dialect
2016-11-18 15:59:31.528 DEBUG 8424 --- [restartedMain] o.h.e.j.env.spi.IdentifierHelperBuilder : JDBC driver metadata reported database stores quoted identifiers in neither upper, lower nor mixed case
答案 0 :(得分:2)
将此属性添加到您的hibernate配置:
hibernate.temp.use_jdbc_metadata_defaults=false