Introduce database-name in <jdbc:embedded-database>
Prior to this commit, the EmbeddedDatabaseBeanDefinitionParser set the name of the embedded database that it configured to the value of its 'id'. This made it impossible to assign unique names to embedded databases if the same bean 'id' (e.g, 'dataSource') was used across multiple application contexts loaded within the same JVM, which is often the case within an integration test suite. In contrast, the EmbeddedDatabaseBuilder already provides support for setting the name in Java Config. Thus there is a disconnect between XML and Java configuration. This commit addresses this issue by introducing a 'database-name' attribute in <jdbc:embedded-database />. This allows developers to set unique names for embedded databases -- for example, via a SpEL expression or a property placeholder that is influenced by the current active bean definition profiles. Issue: SPR-12835
This commit is contained in:
@@ -34,6 +34,16 @@
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="database-name" type="xsd:string" default="">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name to assign to the embedded database. Note that this is not the
|
||||
bean name but rather the name of the embedded database as used in the JDBC
|
||||
connection URL for the database. Defaults to "testdb" if an explicit bean
|
||||
'id' has not been provided.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="type" type="databaseType" default="HSQL">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user