org.springframework.boot.context.config.ConfigFileApplicationListener#org.springframework.cloud.bootstrap.BootstrapApplicationListener源码实例Demo

下面列出了org.springframework.boot.context.config.ConfigFileApplicationListener#org.springframework.cloud.bootstrap.BootstrapApplicationListener 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private void insert(MutablePropertySources propertySources,
		PropertySource<?> propertySource) {
	if (propertySources
			.contains(BootstrapApplicationListener.BOOTSTRAP_PROPERTY_SOURCE_NAME)) {
		if (DECRYPTED_BOOTSTRAP_PROPERTY_SOURCE_NAME
				.equals(propertySource.getName())) {
			propertySources.addBefore(
					BootstrapApplicationListener.BOOTSTRAP_PROPERTY_SOURCE_NAME,
					propertySource);
		}
		else {
			propertySources.addAfter(
					BootstrapApplicationListener.BOOTSTRAP_PROPERTY_SOURCE_NAME,
					propertySource);
		}
	}
	else {
		propertySources.addFirst(propertySource);
	}
}
 
@Override
public int getOrder() {
	// order should be greater than
	// BootstrapApplicationListener.DEFAULT_ORDER - so that this
	// listener is invoked after BootstrapApplicationListener, otherwise
	// bootstrap.properties will not have been read. This is required
	// since encrypted text (i.e.
	// passwords) could be configured in bootstrap.properties.
	return BootstrapApplicationListener.DEFAULT_ORDER + 1;
}