spring-boot/src
Andy Wilkinson 468e246dbb Make sure container's started before connection details use it
Prior to this commit, a Testcontainer that was managed as a bean
would not have been started in time if it was accessed before
the bean factory's configuration had been frozen. A common way
for this to occur is when using JPA. The entity manager factory
bean is LoadTimeWeaverAware which causes it to be created before
configuration is frozen. Creating this bean requires the DataSource
which in turn requires the JdbcConnectionDetails and its JDBC URL.
Getting the JDBC URL From the connection details requires the
container hosting the SQL database to have been started.

This commit updates ContainerConnectionDetails, the super-class for
all Testcontainer-based ConnectionDetails implementations, to publish
an event when the Container is retrieved from the details. When this
event is published, TestcontainersLifecycleBeanPostProcessor
initializes all containers that are defined as beans.

Closes gh-40585
2024-05-22 09:15:21 +01:00
..
checkstyle Make sure container's started before connection details use it 2024-05-22 09:15:21 +01:00
nohttp Add Docker Compose support 2023-04-17 01:00:08 -07:00