You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use Junit5 and ru.yandex.qatools.embed:postgresql-embedded in all of our SpringBootTest classes for integration testing against a "real" PostgreSQL because we rely on some JSON features.
The EmbeddedPostgresManager is exposed as a @Bean in a @TestConfigration class which is registered by @ImportAutoConfiguration on a custom annotation (see EmbeddedPostgresSupport).
When upgrading the application to 2.0.4.RELEASE Spring tries to execute the Flyway migrations before the EmbeddedPostgresManager bean is created and therefore fails.
I suspect that this has something to do with #13155.
The text was updated successfully, but these errors were encountered:
There are quite a few things wrong with this project and it worked so far by accident:
EmbeddedPostgresManager is not an auto-configuration. If you'd try to load that as a regular auto-config it would blow up as it's not registered in spring.factories.
There is no ordering whatsoever in that code so you're relying on whatever default the context would apply. In particular that @TestConfiguration will kick in quite late whereas it should make sure to start EmbeddedPostgresManager before the DataSource becomes available
You may want to rework 2 in particular. @AutoConfigureTestDatabase is the closest thing that comes to mind with what you're trying to do.
As I believe the sample you've exhibited has some fundamental issue I am going to close this one. If you have more questions, please ask on StackOverflow or join us on Gitter.
I inherited the presented code and it was always suspect to me.
I found a solution which is more like EmbeddedMongoAutoConfiguraion because AutoConfigureTestDatabase expects that the DataSource is swapped out what we want to avoid.
See https://github.com/mvitz/spring-boot-jdbc-test for an example application.
We use Junit5 and
ru.yandex.qatools.embed:postgresql-embedded
in all of ourSpringBootTest
classes for integration testing against a "real" PostgreSQL because we rely on some JSON features.The
EmbeddedPostgresManager
is exposed as a@Bean
in a@TestConfigration
class which is registered by@ImportAutoConfiguration
on a custom annotation (seeEmbeddedPostgresSupport
).When upgrading the application to 2.0.4.RELEASE Spring tries to execute the Flyway migrations before the
EmbeddedPostgresManager
bean is created and therefore fails.I suspect that this has something to do with #13155.
The text was updated successfully, but these errors were encountered: