Example usage for org.springframework.core.env Environment hashCode

List of usage examples for org.springframework.core.env Environment hashCode

Introduction

In this page you can find the example usage for org.springframework.core.env Environment hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:org.apache.servicecomb.config.ConfigurationSpringInitializer.java

/**
 * Try to get a name for identifying the environment.
 * @param environment the target that the name is generated for.
 * @return The generated name for the environment.
 *///from   w w w  . j  a v a2s  . c om
private String generateNameForEnvironment(Environment environment) {
    String environmentName = environment.getProperty("spring.config.name");
    if (!StringUtils.isEmpty(environmentName)) {
        return environmentName;
    }

    environmentName = environment.getProperty("spring.application.name");
    if (!StringUtils.isEmpty(environmentName)) {
        return environmentName;
    }

    return environment.getClass().getName() + "@" + environment.hashCode();
}