Wiring into application configuration

Required

The IDatastoreCustomisations Spring Bean used in some DaSH 1.x projects has been replaced by a default IDatastoreConfigurator Spring Bean exposed by the IDatastoreConfiguratorSetup interface implementation. The main datastore configuration class will need to autowire an IDatastoreConfigurator object, to have access to enabled schemas and the stores/references defined for each of them:

configurator.getEnabledSchemas()
		.forEach(
				schema -> {
                    // For existing stores and reference lists
					stores.addAll(configurator.getCustomisations(schema).getAddedStores());
					refs.addAll(configurator.getCustomisations(schema).getAddedReferences());
				}
		);
IDatastoreSchemaDescription description	= new DatastoreSchemaDescription(stores, refs);

Optional

Previous versions of DaSH required autowiring an IDatastoreCustomisations Spring Bean to ensure the static DatastoreHelper class contained the required customisations, but the resulting object did not provide further functionality. Due to the common usage of store/reference Collection beans, bean ordering posed a potential problem as stores could be created prior to any customisations being defined.

To mitigate this issue when using DaSH 2.0, the IDatastoreConfiguratorSetup provides addModifications() and buildSchemas() methods that are called prior to exposing the IDatastoreConfigurator Spring Bean.

The required example assumes the older pattern of creating default lists of stores and references, on top of which configurator customisations are added. To reduce complexity, if you define all stores on the configurator (see adding stores or the optional datastore configuration migration), the configurator can create the IDatastoreSchemaDescription object directly:

IDatastoreSchemaDescription description = configurator.buildSchemaDescription();
search.js