This commit clarifies that DataSourceInitializedEvent is only to be
used by the datasource initializer facility and JPA (Hibernate). The
even is renamed to DataSourceSchemaCreatedEvent to clarify what it
actually signals.
Closes gh-4292
This commit clarifies the scope of the datasource initializr. In
particular, it is not possible to create the schema with that facility
and let Hibernate creates additional tables.
Closes gh-9048
This commit separates the lifecycle of the datasource initialization
from DataSourceInitializer itself. It also makes sure that a @Primary
data source is no longer required.
Closes gh-10502
Previously, if the file watcher thread tried to stop the
FileSystemWatcher when another thread was already stopping it a
livelock could occur. The livelock occurred because the file watcher
thread would attempt to lock a monitor that was being held by a thread
that had joined the file watcher thread and was waiting for it to die.
This commit avoid the livelock by narrowing the synchronization that's
used when stopping the FileSystemWatcher. The monitor is used to
obtain a reference to the file watcher thread in a thread-safe manner,
but it is released prior to joining the file watcher thread and
waiting for it to die. This will allow a parallel attempt by the
file watcher thread to stop itself to succeed.
Closes gh-10496
Previously, when deploying a Spring Boot application to a container,
the servlet context property source was not fully initialised until
the context was refreshed. This led to a problem where a value from a
property source with lower precedence would be seen during the early
stages of the application starting. Once the servlet context property
source had been initialized, its value for the property would then
become visible effectively making it appear as if the property's
value had changed during startup. This led to a specific problem
with determining active profiles.
If spring.profiles.active was set both in JNDI and via the servlet
context both profiles would end up being active, rather than the
more intuitive behaviour of the profiles made active via the servlet
context overriding those made active via JNDI.
This commit updates SpringBootServletInitializer so that it explicitly
creates the StandardServletEnvironment and initializes its property
sources using the servlet context. This is done before the application
is created and run, thereby ensuring that the servlet context
property source is available throughout the application's startup.
Closes gh-9972