Search in sources :

Example 11 with BeanFactoryAware

use of org.springframework.beans.factory.BeanFactoryAware in project mule by mulesoft.

the class DefaultListableBeanFactory method setAutowireCandidateResolver.

/**
 * Set a custom autowire candidate resolver for this BeanFactory to use when deciding whether a bean definition should be
 * considered as a candidate for autowiring.
 */
public void setAutowireCandidateResolver(final AutowireCandidateResolver autowireCandidateResolver) {
    Assert.notNull(autowireCandidateResolver, "AutowireCandidateResolver must not be null");
    if (autowireCandidateResolver instanceof BeanFactoryAware) {
        if (System.getSecurityManager() != null) {
            final BeanFactory target = this;
            AccessController.doPrivileged(new PrivilegedAction<Object>() {

                @Override
                public Object run() {
                    ((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(target);
                    return null;
                }
            }, getAccessControlContext());
        } else {
            ((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(this);
        }
    }
    this.autowireCandidateResolver = autowireCandidateResolver;
}
Also used : BeanFactoryAware(org.springframework.beans.factory.BeanFactoryAware) ConfigurableListableBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) BeanFactory(org.springframework.beans.factory.BeanFactory) ConfigurableBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory)

Aggregations

BeanFactoryAware (org.springframework.beans.factory.BeanFactoryAware)11 BeanFactory (org.springframework.beans.factory.BeanFactory)2 BeanInitializationException (org.springframework.beans.factory.BeanInitializationException)2 BeanNameAware (org.springframework.beans.factory.BeanNameAware)2 InitializingBean (org.springframework.beans.factory.InitializingBean)2 ConfigurableListableBeanFactory (org.springframework.beans.factory.config.ConfigurableListableBeanFactory)2 ChannelTopic (org.springframework.data.redis.listener.ChannelTopic)2 MessageListenerAdapter (org.springframework.data.redis.listener.adapter.MessageListenerAdapter)2 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Test (org.junit.jupiter.api.Test)1 BeansException (org.springframework.beans.BeansException)1 FatalBeanException (org.springframework.beans.FatalBeanException)1 ConfigurableBeanFactory (org.springframework.beans.factory.config.ConfigurableBeanFactory)1 ConsumerDestination (org.springframework.cloud.stream.provisioning.ConsumerDestination)1 ApplicationContextAware (org.springframework.context.ApplicationContextAware)1 ApplicationEventPublisherAware (org.springframework.context.ApplicationEventPublisherAware)1