Skip to content

Commit

Permalink
Merge pull request #194 from kumuluz/bugfix/configSourceSort
Browse files Browse the repository at this point in the history
Sort config sources after their initialization from service loader
  • Loading branch information
urbim authored Feb 15, 2021
2 parents 2daaa51 + f964f6a commit 9ca9290
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/src/main/java/com/kumuluz/ee/EeApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
package com.kumuluz.ee;

import com.kumuluz.ee.common.*;
import com.kumuluz.ee.common.config.DataSourceConfig;
import com.kumuluz.ee.common.config.DataSourcePoolConfig;
import com.kumuluz.ee.common.config.EeConfig;
import com.kumuluz.ee.common.config.XaDataSourceConfig;
import com.kumuluz.ee.common.datasources.NonJtaXADataSourceWrapper;
import com.kumuluz.ee.common.datasources.XADataSourceBuilder;
import com.kumuluz.ee.common.datasources.XADataSourceWrapper;
import com.kumuluz.ee.common.dependencies.*;
import com.kumuluz.ee.common.exceptions.KumuluzServerException;
import com.kumuluz.ee.common.filters.PoweredByFilter;
Expand All @@ -45,13 +39,10 @@
import com.kumuluz.ee.configuration.utils.ConfigurationUtil;
import com.kumuluz.ee.factories.AgroalDataSourceFactory;
import com.kumuluz.ee.factories.EeConfigFactory;
import com.kumuluz.ee.factories.JtaXADataSourceFactory;
import com.kumuluz.ee.loaders.*;
import com.kumuluz.ee.logs.impl.JavaUtilDefaultLogConfigurator;
import com.zaxxer.hikari.HikariDataSource;
import io.agroal.api.AgroalDataSource;

import javax.sql.XADataSource;
import java.util.*;
import java.util.logging.Handler;
import java.util.logging.LogManager;
Expand Down Expand Up @@ -118,6 +109,9 @@ private void initialize() {

ConfigurationUtil.initialize(configImpl);

// we need to order config sources here in order to ensure correct initialisation of EeConfig
configImpl.getConfigurationSources().sort(Comparator.comparingInt(ConfigurationSource::getOrdinal).reversed());

if (this.eeConfig == null) {
this.eeConfig = EeConfigFactory.buildEeConfig();
} else if (!EeConfigFactory.isEeConfigValid(this.eeConfig)) {
Expand Down Expand Up @@ -239,6 +233,7 @@ private void initialize() {
}
}

// sort the configuration sources again since new sources could be added by extensions
configImpl.getConfigurationSources().sort(Comparator.comparingInt(ConfigurationSource::getOrdinal).reversed());

log.info("Config extensions initialized");
Expand Down

0 comments on commit 9ca9290

Please sign in to comment.