|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
45 | 45 | * for the database.
|
46 | 46 | * <li>Call {@link #setDatabaseName} to set an explicit name for the database.
|
47 | 47 | * <li>Call {@link #setDatabaseType} to set the database type if you wish to
|
48 |
| - * use one of the supported types. |
| 48 | + * use one of the supported types with their default settings. |
49 | 49 | * <li>Call {@link #setDatabaseConfigurer} to configure support for a custom
|
50 |
| - * embedded database type. |
| 50 | + * embedded database type, or |
| 51 | + * {@linkplain EmbeddedDatabaseConfigurers#customizeConfigurer customize} the |
| 52 | + * default of a supported types. |
51 | 53 | * <li>Call {@link #setDatabasePopulator} to change the algorithm used to
|
52 | 54 | * populate the database.
|
53 | 55 | * <li>Call {@link #setDataSourceFactory} to change the type of
|
|
60 | 62 | * @author Keith Donald
|
61 | 63 | * @author Juergen Hoeller
|
62 | 64 | * @author Sam Brannen
|
| 65 | + * @author Stephane Nicoll |
63 | 66 | * @since 3.0
|
64 | 67 | */
|
65 | 68 | public class EmbeddedDatabaseFactory {
|
@@ -124,17 +127,23 @@ public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
|
124 | 127 |
|
125 | 128 | /**
|
126 | 129 | * Set the type of embedded database to use.
|
127 |
| - * <p>Call this when you wish to configure one of the pre-supported types. |
| 130 | + * <p>Call this when you wish to configure one of the pre-supported types |
| 131 | + * with their default settings. |
128 | 132 | * <p>Defaults to HSQL.
|
129 | 133 | * @param type the database type
|
130 | 134 | */
|
131 | 135 | public void setDatabaseType(EmbeddedDatabaseType type) {
|
132 |
| - this.databaseConfigurer = EmbeddedDatabaseConfigurerFactory.getConfigurer(type); |
| 136 | + this.databaseConfigurer = EmbeddedDatabaseConfigurers.getConfigurer(type); |
133 | 137 | }
|
134 | 138 |
|
135 | 139 | /**
|
136 | 140 | * Set the strategy that will be used to configure the embedded database instance.
|
137 |
| - * <p>Call this when you wish to use an embedded database type not already supported. |
| 141 | + * <p>Call this with |
| 142 | + * {@linkplain EmbeddedDatabaseConfigurers#customizeConfigurer customizeConfigurer} |
| 143 | + * when you wish to customize the settings of one of the pre-supported types. |
| 144 | + * Alternatively, use this when you wish to use an embedded database type not |
| 145 | + * already supported. |
| 146 | + * @since 6.2 |
138 | 147 | */
|
139 | 148 | public void setDatabaseConfigurer(EmbeddedDatabaseConfigurer configurer) {
|
140 | 149 | this.databaseConfigurer = configurer;
|
@@ -178,7 +187,7 @@ protected void initDatabase() {
|
178 | 187 |
|
179 | 188 | // Create the embedded database first
|
180 | 189 | if (this.databaseConfigurer == null) {
|
181 |
| - this.databaseConfigurer = EmbeddedDatabaseConfigurerFactory.getConfigurer(EmbeddedDatabaseType.HSQL); |
| 190 | + this.databaseConfigurer = EmbeddedDatabaseConfigurers.getConfigurer(EmbeddedDatabaseType.HSQL); |
182 | 191 | }
|
183 | 192 | this.databaseConfigurer.configureConnectionProperties(
|
184 | 193 | this.dataSourceFactory.getConnectionProperties(), this.databaseName);
|
|
0 commit comments