Skip to content

Commit

Permalink
Fixed order of the BootstrapConfigFileApplicationListener so that i…
Browse files Browse the repository at this point in the history
…t always runs after the `ConfigDataEnvironmentPostProcessor` (#1213)

* Changed order of `BootstrapConfigFileApplicationListener`

Previously `BootstrapConfigFileApplicationListener` had the same order
as `ConfigDataEnvironmentPostProcessor`. This made it indeterminable
which one would run first. However, the
`BootstrapConfigFileApplicationListener` relies on the
`ConfigDataEnvironmentPostProcessor` to make sure the
`Environment.activeProfiles` are correctly set, so it must always run
after the `ConfigDataEnvironmentPostProcessor`.

* Using `Math.addExact` for adding one to the `ConfigDataEnvironmentPostProcessor.DEFAULT_ORDER` so that any accidental overflow results in an exception
  • Loading branch information
mzeijen authored Oct 12, 2023
1 parent 56f16d1 commit 9ea5801
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ public class BootstrapConfigFileApplicationListener
/**
* The default order for the processor.
*/
public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 10;
public static final int DEFAULT_ORDER =
// This listener needs to run after the `ConfigDataEnvironmentPostProcessor` to
// make sure the `Environment.activeProfiles` are correctly set
Math.addExact(ConfigDataEnvironmentPostProcessor.ORDER, 1);

private final Log logger;

Expand Down

0 comments on commit 9ea5801

Please sign in to comment.