Spring-boot datasource commit trouble

buræquete :

My application uses Spring-Boot 1.4.1.RELEASE and the configuration of my datasource is as follows;

spring:
  datasource:
    url: ***
    username: ***
    password: ***
    driver-class-name: oracle.jdbc.driver.OracleDriver
    initial-size: 1
    max-active: 100
    max-idle: 30
    min-idle: 1
    max-wait: 0
    pool-prepared-statements: true
    max-open-prepared-statements: 3

The problem is that the last case of my integration testing if it contains a @Sql setup logic in it, fails to commit the last setup SQL. The trouble happens rarely due to the reordering of the cases, and the fact that there is only a handful cases with setup logic to prepare DB. There is no configuration but the one for the OracleDB, and that is in the ConfigClass.

@SpringBootTest(classes = ConfigClass.class)
public class EtcTest {

    @After
    public void teardown() {
        // teardwon X, Y, & Z
    }

    @Test
    @Sql("setupX.sql")
    @Sql("setupY.sql")
    @Sql("setupZ.sql")
    public void get_fromDb() {
        List<Etc> list = buildExpectedList();
        Obj expected = buildExpected();
        Obj actual = getCallToAPI();

        assertThat(rs.getX()).isEqualTo(expected.getX());
        assertThat(rs.getY()).isEqualTo(expected.getY());
        assertThat(rs.getZ()).containsAll(list);
    }
}

The trouble, for example in the above case if it were the last integration case, that it fails to commit the last SQL in the @Sql annotations, namely SetupZ.sql, but the data is not completely missing, it inserts the primary key, and sometimes columnA, or columnB, it is as if something is really wrong here.

Would the presence or absence of some configuration cause this? If not what would be the reason?

buræquete :

This was due to some conflicting libraries within both JUnit & Spring/Hibernate. After updating to the latest Spring & Junit version & updating to Java8 the issue is gone.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=447064&siteId=1