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

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

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this 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 www  . ja v  a2  s.com*/
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();
}

From source file:org.springframework.xd.dirt.server.container.ContainerServerApplication.java

@Override
public void setEnvironment(Environment environment) {
    Assert.isInstanceOf(ConfigurableEnvironment.class, environment,
            "unsupported environment type. " + environment.getClass());
    this.environment = (ConfigurableEnvironment) environment;
}