Болезненный переход со spring-boot 2.6.3 на 2.7.x
Я пытаюсь перевести сервис с версией spring-boot 2.6.3 на 2.7.x (конкретно 2.7.6). Как только я это делаю, некоторые @DapaJpaTest-ы начинают падать, например:
@DataJpaTest
@ContextConfiguration(classes = [TestRepositoryConfig::class])
internal class BaseEntityRepositoryTest {
@Autowired
internal lateinit var repository: TestRepository
@Test
internal fun `must check active by id`() {
val entity = repository.save(TestEntity(name = "test"))
val result = repository.existsByIdAndActiveTrue(entity.id)
assertThat(result).isTrue
}
выдает следующую ошибку:
BaseEntityRepositoryTest > must check active by id$data_commons() FAILED
org.opentest4j.AssertionFailedError:
Expecting value to be true but was false
at [email protected]/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at [email protected]/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at [email protected]/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at app//ru.sberbank.af.data.common.repository.BaseEntityRepositoryTest.must check active by id$data_commons(BaseEntityRepositoryTest.kt:77)
Зависимости у меня следующие:
testImplementation("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin")
testImplementation("net.wuerl.kotlin:assertj-core-kotlin")
testImplementation("org.testcontainers:postgresql")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.awaitility:awaitility")
Вот тут https://stackoverflow.com/questions/72718566/datajpatest-breaks-after-upgrade-from-spring-boot-2-6-6-to-2-7-0 как будто бы пишут про такую же проблему, но я не понимаю, как все-таки ее решить (проблема, как я понял, в h2). Ну и сущность с репозиторием лежат так же в тестовом модуле, и есть конфигурационный файл:
@Configuration
@EnableJpaRepositories(basePackageClasses = [TestRepository::class])
@EntityScan(basePackageClasses = [TestEntity::class])
internal class TestRepositoryConfig
Кто-нибудь сталкивался с таким?