Search in sources :

Example 21 with InitializingBean

use of org.springframework.beans.factory.InitializingBean in project cuba by cuba-platform.

the class WebAbstractDataGrid method autowireContext.

protected void autowireContext(Renderer instance) {
    AutowireCapableBeanFactory autowireBeanFactory = applicationContext.getAutowireCapableBeanFactory();
    autowireBeanFactory.autowireBean(instance);
    if (instance instanceof ApplicationContextAware) {
        ((ApplicationContextAware) instance).setApplicationContext(applicationContext);
    }
    if (instance instanceof InitializingBean) {
        try {
            ((InitializingBean) instance).afterPropertiesSet();
        } catch (Exception e) {
            throw new RuntimeException("Unable to initialize Renderer - calling afterPropertiesSet for " + instance.getClass(), e);
        }
    }
}
Also used : ApplicationContextAware(org.springframework.context.ApplicationContextAware) InitializingBean(org.springframework.beans.factory.InitializingBean) AutowireCapableBeanFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 22 with InitializingBean

use of org.springframework.beans.factory.InitializingBean in project cuba by cuba-platform.

the class AppUI method autowireContext.

protected void autowireContext(Object instance, ApplicationContext applicationContext) {
    AutowireCapableBeanFactory autowireBeanFactory = applicationContext.getAutowireCapableBeanFactory();
    autowireBeanFactory.autowireBean(instance);
    if (instance instanceof ApplicationContextAware) {
        ((ApplicationContextAware) instance).setApplicationContext(applicationContext);
    }
    if (instance instanceof InitializingBean) {
        try {
            ((InitializingBean) instance).afterPropertiesSet();
        } catch (Exception e) {
            throw new RuntimeException("Unable to initialize UI Component - calling afterPropertiesSet for " + instance.getClass(), e);
        }
    }
}
Also used : ApplicationContextAware(org.springframework.context.ApplicationContextAware) InitializingBean(org.springframework.beans.factory.InitializingBean) AutowireCapableBeanFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory) NoUserSessionException(com.haulmont.cuba.security.global.NoUserSessionException) LoginException(com.haulmont.cuba.security.global.LoginException) RemoteAccessException(org.springframework.remoting.RemoteAccessException) LocalServiceAccessException(com.haulmont.cuba.web.sys.remoting.LocalServiceAccessException) PaintException(com.vaadin.server.PaintException)

Example 23 with InitializingBean

use of org.springframework.beans.factory.InitializingBean in project cuba by cuba-platform.

the class WebUiComponents method autowireContext.

protected void autowireContext(Component instance) {
    AutowireCapableBeanFactory autowireBeanFactory = applicationContext.getAutowireCapableBeanFactory();
    autowireBeanFactory.autowireBean(instance);
    if (instance instanceof ApplicationContextAware) {
        ((ApplicationContextAware) instance).setApplicationContext(applicationContext);
    }
    if (instance instanceof InitializingBean) {
        try {
            ((InitializingBean) instance).afterPropertiesSet();
        } catch (Exception e) {
            throw new RuntimeException("Unable to initialize UI Component - calling afterPropertiesSet for " + instance.getClass(), e);
        }
    }
}
Also used : ApplicationContextAware(org.springframework.context.ApplicationContextAware) InitializingBean(org.springframework.beans.factory.InitializingBean) AutowireCapableBeanFactory(org.springframework.beans.factory.config.AutowireCapableBeanFactory) DevelopmentException(com.haulmont.cuba.core.global.DevelopmentException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 24 with InitializingBean

use of org.springframework.beans.factory.InitializingBean in project Settler by EmhyrVarEmreis.

the class ExceptionHandlingAsyncTaskExecutor method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    if (executor instanceof InitializingBean) {
        InitializingBean bean = (InitializingBean) executor;
        bean.afterPropertiesSet();
    }
}
Also used : InitializingBean(org.springframework.beans.factory.InitializingBean)

Example 25 with InitializingBean

use of org.springframework.beans.factory.InitializingBean in project mica2 by obiba.

the class MicaAsyncTaskExecutor method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    if (executor instanceof InitializingBean) {
        InitializingBean bean = (InitializingBean) executor;
        bean.afterPropertiesSet();
    }
}
Also used : InitializingBean(org.springframework.beans.factory.InitializingBean)

Aggregations

InitializingBean (org.springframework.beans.factory.InitializingBean)27 ApplicationContextAware (org.springframework.context.ApplicationContextAware)8 AutowireCapableBeanFactory (org.springframework.beans.factory.config.AutowireCapableBeanFactory)6 Bean (org.springframework.context.annotation.Bean)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 MessageChannel (org.springframework.messaging.MessageChannel)4 Function (java.util.function.Function)3 DisposableBean (org.springframework.beans.factory.DisposableBean)3 AbstractMessageChannel (org.springframework.integration.channel.AbstractMessageChannel)3 FluxMessageChannel (org.springframework.integration.channel.FluxMessageChannel)3 DevelopmentException (com.haulmont.cuba.core.global.DevelopmentException)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Supplier (java.util.function.Supplier)2 BeansException (org.springframework.beans.BeansException)2 BeanFactoryAware (org.springframework.beans.factory.BeanFactoryAware)2