user12384512
user12384512

Reputation: 3401

Spring boot hibernate slow startup

@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);
    }

}

I have very simple integration test, hibernate and postgresql database. Only 2 repositories and 1 controller. Running this integration test takes about 62 seconds. What's going on under the hood ?

I have only 2 domain objects and only 2 repositories. Is there any way to speed up test ? Looks like most of the time is taken by hibernate

40 seconds from 62 is spent there -

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

Upvotes: 3

Views: 4103

Answers (1)

coms
coms

Reputation: 479

Add this property to your hibernate configuration:

hibernate.temp.use_jdbc_metadata_defaults=false

Upvotes: 4

Related Questions