Example usage for org.springframework.context ConfigurableApplicationContext SYSTEM_ENVIRONMENT_BEAN_NAME

List of usage examples for org.springframework.context ConfigurableApplicationContext SYSTEM_ENVIRONMENT_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.context ConfigurableApplicationContext SYSTEM_ENVIRONMENT_BEAN_NAME.

Prototype

String SYSTEM_ENVIRONMENT_BEAN_NAME

To view the source code for org.springframework.context ConfigurableApplicationContext SYSTEM_ENVIRONMENT_BEAN_NAME.

Click Source Link

Document

Name of the System environment bean in the factory.

Usage

From source file:org.mule.module.spel.EvaluationContextFactory.java

public EvaluationContext create(MuleMessage message) {
    Assert.notNull(message, "Message cannot be null");

    StandardEvaluationContext simpleContext = new StandardEvaluationContext();

    simpleContext.setVariable(CONTEXT_VAR_NAME, muleContext);
    simpleContext.setVariable(REGISTRY_VAR_NAME, muleRegistry);
    simpleContext.setVariable(MESSAGE_VAR_NAME, message);
    simpleContext.setVariable(ORIGINAL_PAYLOAD_VAR_NAME, message.getOriginalPayload());
    simpleContext.setVariable(PAYLOAD_VAR_NAME, message.getPayload());
    simpleContext.setVariable(ID_VAR_NAME, message.getUniqueId());

    /* systemProperties and systemEnvironment are spring beans already registered
       in the mule registry, and thus available as @systemEnvironment and @systemProperties.
       But this is collateral, so to properly to mimic Spring framework behavior both beans will
       be added as variables. /*from  w ww. jav  a  2 s  .com*/
    */

    if (muleRegistry != null) {
        simpleContext.setVariable(SYSTEM_PROPERTIES_VAR_NAME,
                muleRegistry.get(ConfigurableApplicationContext.SYSTEM_PROPERTIES_BEAN_NAME));
        simpleContext.setVariable(ENVIRONMENT_VAR_NAME,
                muleRegistry.get(ConfigurableApplicationContext.SYSTEM_ENVIRONMENT_BEAN_NAME));
    }

    simpleContext.setRootObject(message.getPayload());

    simpleContext.setBeanResolver(beanResolver);
    return simpleContext;
}