/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spring-boot-modules/spring-boot-testing-3/src/test/java/com/baeldung/embeddedpostgresql/EmbeddedPostgresWithFlywayConfiguration.java
26 строк
883 B
ICKostiantyn.Ivanov
BAEL-7984 - Embedded PostgreSQL for Spring Boot Tests
24 май 2024, 17:12
24 май 2024, 17:12
f049e72
Код
Авторство
О чём код?
package com.baeldung.embeddedpostgresql; import java.sql.SQLException; import javax.sql.DataSource; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import com.opentable.db.postgres.embedded.FlywayPreparer; import com.opentable.db.postgres.embedded.PreparedDbProvider; @Configuration @EnableJpaRepositories(basePackageClasses = PersonRepository.class) @EntityScan(basePackageClasses = Person.class) public class EmbeddedPostgresWithFlywayConfiguration { @Bean public DataSource dataSource() throws SQLException { return PreparedDbProvider .forPreparer(FlywayPreparer.forClasspathLocation("db/migrations")) .createDataSource(); } }