Example usage for org.springframework.beans.factory.config ConfigurableListableBeanFactory hasEmbeddedValueResolver

List of usage examples for org.springframework.beans.factory.config ConfigurableListableBeanFactory hasEmbeddedValueResolver

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config ConfigurableListableBeanFactory hasEmbeddedValueResolver.

Prototype

boolean hasEmbeddedValueResolver();

Source Link

Document

Determine whether an embedded value resolver has been registered with this bean factory, to be applied through #resolveEmbeddedValue(String) .

Usage

From source file:org.springframework.context.support.AbstractApplicationContext.java

/**
 * Finish the initialization of this context's bean factory,
 * initializing all remaining singleton beans.
 *//*from  w  w  w .  j  a v a 2 s . c o m*/
protected void finishBeanFactoryInitialization(ConfigurableListableBeanFactory beanFactory) {
    // Initialize conversion service for this context.
    if (beanFactory.containsBean(CONVERSION_SERVICE_BEAN_NAME)
            && beanFactory.isTypeMatch(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class)) {
        beanFactory.setConversionService(
                beanFactory.getBean(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class));
    }

    // Register a default embedded value resolver if no bean post-processor
    // (such as a PropertyPlaceholderConfigurer bean) registered any before:
    // at this point, primarily for resolution in annotation attribute values.
    if (!beanFactory.hasEmbeddedValueResolver()) {
        beanFactory.addEmbeddedValueResolver(strVal -> getEnvironment().resolvePlaceholders(strVal));
    }

    // Initialize LoadTimeWeaverAware beans early to allow for registering their transformers early.
    String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, false);
    for (String weaverAwareName : weaverAwareNames) {
        getBean(weaverAwareName);
    }

    // Stop using the temporary ClassLoader for type matching.
    beanFactory.setTempClassLoader(null);

    // Allow for caching all bean definition metadata, not expecting further changes.
    beanFactory.freezeConfiguration();

    // Instantiate all remaining (non-lazy-init) singletons.
    beanFactory.preInstantiateSingletons();
}