spring-boot/spring-boot-project
Phillip Webb 89874d351a Ensure containers are started before binding datasource properties
Update `TestcontainersLifecycleBeanPostProcessor` so that containers
are now initialized either on the first `postProcessAfterInitialization`
call with a frozen configuration or just before a test container
property is supplied.

Prior to this commit, it was assumed that the first post-process call
after the configuration was frozen was suitably early to initialize
the containers. This turns out to not be no always the case.

Specifically, in the `finishBeanFactoryInitialization` method of
`AbstractApplicationContext` we see that `LoadTimeWeaverAware` beans
are obtained before the configuration is frozen. One such bean is
`DefaultPersistenceUnitManager` which is likely to need datasource
properties that will require a started container.

To fix the problem, the `TestcontainersPropertySource` now publishes
a `BeforeTestcontainersPropertySuppliedEvent` to the ApplicationContext
just before any value is supplied. By listening for this event, we can
ensure that containers are initialized and started before any dynamic
property is read.

Fixes gh-38913
2024-01-16 10:36:54 -08:00
..
spring-boot Fix configuration property conversion for CharSequence inputs 2024-01-12 11:09:29 +00:00
spring-boot-actuator Merge branch '3.1.x' into 3.2.x 2024-01-12 17:08:23 +00:00
spring-boot-actuator-autoconfigure Add configuration property to enable micrometer annotations 2024-01-15 13:51:15 +01:00
spring-boot-autoconfigure Merge branch '3.1.x' into 3.2.x 2024-01-11 13:55:34 +00:00
spring-boot-dependencies Upgrade to MySQL 8.3.0 2024-01-16 16:33:29 +01:00
spring-boot-devtools Merge branch '3.1.x' into 3.2.x 2024-01-11 10:33:57 +00:00
spring-boot-docker-compose Merge branch '3.1.x' 2023-12-05 14:02:52 +01:00
spring-boot-docs Merge branch '3.1.x' into 3.2.x 2024-01-16 16:07:37 +00:00
spring-boot-parent Polish 2023-11-22 10:16:19 +01:00
spring-boot-starters Add the LangChain4J to the list of community starters 2023-12-19 23:14:01 -08:00
spring-boot-test Merge branch '3.1.x' into 3.2.x 2024-01-11 10:33:57 +00:00
spring-boot-test-autoconfigure Merge branch '3.1.x' into 3.2.x 2024-01-11 10:33:57 +00:00
spring-boot-testcontainers Ensure containers are started before binding datasource properties 2024-01-16 10:36:54 -08:00
spring-boot-tools Fix handling of nested: UNC paths on Windows 2024-01-12 15:53:19 +00:00