Buggy code:
public class BootstrapApplicationListener implements ApplicationListener < ApplicationEnvironmentPreparedEvent > , Ordered { public static final String BOOTSTRAP_PROPERTY_SOURCE_NAME = "bootstrap" ; public static final int DEFAULT_ORDER = ( Ordered . HIGHEST_PRECEDENCE ) + 5 ; private int order = BootstrapApplicationListener . DEFAULT_ORDER ; @ Override public void onApplicationEvent ( ApplicationEnvironmentPreparedEvent event ) { } private ConfigurableApplicationContext bootstrapServiceContext ( ConfigurableEnvironment environment , final SpringApplication application ) { StandardEnvironment bootstrapEnvironment = new StandardEnvironment ( ) ; MutablePropertySources bootstrapProperties = bootstrapEnvironment . getPropertySources ( ) ; for ( PropertySource < ? > source : bootstrapProperties ) { bootstrapProperties . remove ( source . getName ( ) ) ; } String configName = environment . resolvePlaceholders ( "${spring.cloud.bootstrap.name:bootstrap}" ) ; String configLocation = environment . resolvePlaceholders ( "${spring.cloud.bootstrap.location:}" ) ; Map < String , Object > bootstrapMap = new HashMap < > ( ) ; bootstrapMap . put ( "spring.config.name" , configName ) ; if ( StringUtils . hasText ( configLocation ) ) { <START_BUG> bootstrapMap . put ( "spring.config.location" , configName ) ; <END_BUG> } bootstrapProperties . addFirst ( new MapPropertySource ( BootstrapApplicationListener . BOOTSTRAP_PROPERTY_SOURCE_NAME , bootstrapMap ) ) ; bootstrapProperties . addFirst ( new MapPropertySource ( "bootstrapInProgress" , Collections . < String , Object > emptyMap ( ) ) ) ; for ( PropertySource < ? > source : environment . getPropertySources ( ) ) { bootstrapProperties . addLast ( source ) ; } ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; List < String > names = SpringFactoriesLoader . loadFactoryNames ( BootstrapConfiguration . class , classLoader ) ; SpringApplicationBuilder builder = new SpringApplicationBuilder ( ) . profiles ( environment . getActiveProfiles ( ) ) . showBanner ( false ) . environment ( bootstrapEnvironment ) . properties ( ( "spring.application.name:" + configName ) ) . web ( false ) ; List < Class < ? > > sources = new ArrayList < > ( ) ; for ( String name : names ) { Class < ? > cls = ClassUtils . resolveClassName ( name , null ) ; try { cls . getDeclaredAnnotations ( ) ; } catch ( Exception e ) { continue ; } sources . add ( cls ) ; } builder . sources ( sources . toArray ( new Class [ sources . size ( ) ] ) ) ; final ConfigurableApplicationContext context = builder . run ( ) ; addAncestorInitializer ( application , context ) ; bootstrapProperties . remove ( "bootstrapInProgress" ) ; return context ; } private void addAncestorInitializer ( SpringApplication application , ConfigurableApplicationContext context ) { } private void apply ( ConfigurableApplicationContext context , SpringApplication application , ConfigurableEnvironment environment ) { } private < T > List < T > getOrderedBeansOfType ( ListableBeanFactory context , Class < T > type ) { } public void setOrder ( int order ) { } @ Override public int getOrder ( ) { } private static class AncestorInitializer implements ApplicationContextInitializer < ConfigurableApplicationContext > , Ordered { private ConfigurableApplicationContext parent ; public AncestorInitializer ( ConfigurableApplicationContext parent ) { } public void setParent ( ConfigurableApplicationContext parent ) { } @ Override public int getOrder ( ) { } @ Override public void initialize ( ConfigurableApplicationContext context ) { } private void preemptMerge ( MutablePropertySources propertySources , PropertySource < ? > propertySource ) { } } }

Fix:
bootstrapMap . put ( "spring.config.location" , configLocation ) ;