Example usage for org.springframework.boot.cloud CloudPlatform CLOUD_FOUNDRY

List of usage examples for org.springframework.boot.cloud CloudPlatform CLOUD_FOUNDRY

Introduction

In this page you can find the example usage for org.springframework.boot.cloud CloudPlatform CLOUD_FOUNDRY.

Prototype

CloudPlatform CLOUD_FOUNDRY

To view the source code for org.springframework.boot.cloud CloudPlatform CLOUD_FOUNDRY.

Click Source Link

Document

Cloud Foundry platform.

Usage

From source file:org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor.java

@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
    if (CloudPlatform.CLOUD_FOUNDRY.isActive(environment)) {
        Properties properties = new Properties();
        addWithPrefix(properties, getPropertiesFromApplication(environment), "vcap.application.");
        addWithPrefix(properties, getPropertiesFromServices(environment), "vcap.services.");
        MutablePropertySources propertySources = environment.getPropertySources();
        if (propertySources.contains(CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME)) {
            propertySources.addAfter(CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME,
                    new PropertiesPropertySource("vcap", properties));
        } else {//from ww w  .ja v a  2  s  . co  m
            propertySources.addFirst(new PropertiesPropertySource("vcap", properties));
        }
    }
}