运行测试时,我可以从休眠中看到大量日志,描述了创建,删除,更改表和序列事件:
Hibernate: drop table campaign if exists
Hibernate: drop table criteria if exists
...
Hibernate: create sequence campaign_id_seq start with 1 increment by 1
Hibernate: create sequence criteria_condition_id_seq start with 1 increment by 1
...
Hibernate: create table campaign ...
如何禁用这些日志?
我正在使用spring boot并为spring数据jpa存储库编写测试。这是我的测试课程的示例:
@RunWith(SpringRunner.class)
@DataJpaTest
public class MyEntityRepositoryTest {
}
我已经在src/test/resources/application.properties
文件中配置了H2数据库,如下所示:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect
spring.jpa.show-sql=false
debug=false
logging.level.root=WARN
我尝试过spring.jpa.show-sql=false
,debug=false
,但没有运气。