Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate messages when using @DataJpaTest with SpringBoot

I am doing @DataJpaTest on default spring boot settings. When I run the test, hibernate(?) is flooding console with schema creation messages like:

Hibernate: alter table ...
Hibernate: alter table ...
Hibernate: alter table ...
Hibernate: alter table ... 
Hibernate: call next value ...

And so on. Does anyone knows how to disable this messages? I have logback configuration for test with log level OFF on root logger.

/Annonymous

like image 235
xLatency Avatar asked Aug 04 '17 12:08

xLatency


1 Answers

The @DataJpaTest by default show SQL output.

 * If SQL output should be logged.
 * @return if SQL is logged
 */
@PropertyMapping("spring.jpa.show-sql")
boolean showSql() default true;

you can set the showSql=false within the annotation @DataJpaTest(showSql=false)

like image 180
Darren Forsythe Avatar answered Oct 22 '22 08:10

Darren Forsythe