You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 4
Next »
Intro
This module is used to set global configuration on application. This is achieved by generating class with configuration (GlobalConfiguration)
For generation, a special utility project was created with the name configuration-generator
Run from CLI
To generate GlobalConfiguration class you need open a terminal and enter this command:
Flow
During launching spring application according on all active profile all config files merge to
GlobalConfiguration instance and save as a map to spring property source (it happens in PropertySourcesApplicationContextInitializer)
After that according on property source initialize GlobalConfiguration bean (GlobalConfigurationProvider)
Usage example
After generation, this class with can be reused throughout the project
Example of use in flyway configuration:
GlobalConfiguration.Postgres postgres = globalConfiguration.postgres();
FluentConfiguration fluentConfiguration = Flyway.configure()
.dataSource(postgres.jdbcUrl(), postgres.users().flyway(), postgres.passwords().flyway())
.sqlMigrationPrefix("")
.locations(postgres.locationMigration())
.baselineOnMigrate(true);
Flyway flyway = fluentConfiguration.load();
flyway.migrate();