How to populate database only once before @Test methods in spring test?

前端 未结 5 1425
小蘑菇
小蘑菇 2020-12-08 08:00

My next problem testing spring service layer with junit4 is: How to call script that populates database only once before all @Test methods: I want to execute this once befor

5条回答
  •  死守一世寂寞
    2020-12-08 09:04

    in case you are spring boot, u can mention multiple scripts to launch before tests via

    spring.datasource.data=classpath:accounts.sql, classpath:books.sql, classpath:reviews.sql
    

提交回复
热议问题