You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class CustomDatabaseSeedProvider implements DatabaseSeedProvider {
168
+
169
+
@Override
170
+
public boolean matches(String uri) {
171
+
// Return true if uri is supported by this
172
+
// provider.
173
+
}
174
+
175
+
@Override
176
+
public InputStream stream(
177
+
String uri,
178
+
Map<String, Object> options) throws IOException {
179
+
// This method should obtain an input stream in an
180
+
// implementation specific way.
181
+
}
182
+
183
+
@Override
184
+
public void inject(Dependencies dependencies) {
185
+
// This method should provide implementation
186
+
// specific dependencies to the provider.
187
+
}
188
+
189
+
public static class CustomDependencies implements Dependencies {
190
+
@Override
191
+
public <T> T resolveDependency(Class<T> type) {
192
+
// This method should resolve dependencies
193
+
// required by the provider.
194
+
}
195
+
}
196
+
}
197
+
----
198
+
199
+
To implement the custom database seed provider, you must implement three methods on the top-level `DatabaseSeedProvider` interface.
200
+
One method to match the URIs it can manage, one to stream backups or dumps from the given URI, and one to inject dependencies in the provider.
201
+
Additionally you must implement one method on the nested `Dependencies` interface, to resolve any dependencies required by your seed provider implementation.
202
+
203
+
Typically, the match method uses the URI scheme (the part specified before the first colon) to determine whether it can support the given URI or not.
204
+
For example, `file`, `http`, `https` etc.
205
+
206
+
The stream method should implement a scheme-specific way to obtain an input stream for the backup or dump.
207
+
208
+
Implementation specific seed configuration can be passed through from options specified in the `CREATE DATABASE` command using `seedConfig`.
209
+
210
+
==== `SeedProvider` label:deprecated[Deprecated in 5.26]
0 commit comments