org.springframework.beans.factory.config.ConfigurableBeanFactory Java Examples

The following examples show how to use org.springframework.beans.factory.config.ConfigurableBeanFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMessageHandlerMethodFactory.java    From spring-analysis-note with MIT License 7 votes vote down vote up
protected List<HandlerMethodArgumentResolver> initArgumentResolvers() {
	List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
	ConfigurableBeanFactory beanFactory = (this.beanFactory instanceof ConfigurableBeanFactory ?
			(ConfigurableBeanFactory) this.beanFactory : null);

	// Annotation-based argument resolution
	resolvers.add(new HeaderMethodArgumentResolver(this.conversionService, beanFactory));
	resolvers.add(new HeadersMethodArgumentResolver());

	// Type-based argument resolution
	resolvers.add(new MessageMethodArgumentResolver(this.messageConverter));

	if (this.customArgumentResolvers != null) {
		resolvers.addAll(this.customArgumentResolvers);
	}

	Assert.notNull(this.messageConverter, "MessageConverter not configured");
	resolvers.add(new PayloadMethodArgumentResolver(this.messageConverter, this.validator));

	return resolvers;
}
 
Example #2
Source File: DefaultMessageHandlerMethodFactory.java    From java-technology-stack with MIT License 6 votes vote down vote up
protected List<HandlerMethodArgumentResolver> initArgumentResolvers() {
	List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
	ConfigurableBeanFactory cbf = (this.beanFactory instanceof ConfigurableBeanFactory ?
			(ConfigurableBeanFactory) this.beanFactory : null);

	// Annotation-based argument resolution
	resolvers.add(new HeaderMethodArgumentResolver(this.conversionService, cbf));
	resolvers.add(new HeadersMethodArgumentResolver());

	// Type-based argument resolution
	resolvers.add(new MessageMethodArgumentResolver(this.messageConverter));

	if (this.customArgumentResolvers != null) {
		resolvers.addAll(this.customArgumentResolvers);
	}
	resolvers.add(new PayloadArgumentResolver(this.messageConverter, this.validator));

	return resolvers;
}
 
Example #3
Source File: SendToHandlerMethodReturnValueHandler.java    From spring-cloud-aws with Apache License 2.0 6 votes vote down vote up
private String resolveName(String name) {
	if (!(this.beanFactory instanceof ConfigurableBeanFactory)) {
		return name;
	}

	ConfigurableBeanFactory configurableBeanFactory = (ConfigurableBeanFactory) this.beanFactory;

	String placeholdersResolved = configurableBeanFactory.resolveEmbeddedValue(name);
	BeanExpressionResolver exprResolver = configurableBeanFactory
			.getBeanExpressionResolver();
	if (exprResolver == null) {
		return name;
	}
	Object result = exprResolver.evaluate(placeholdersResolved,
			new BeanExpressionContext(configurableBeanFactory, null));
	return result != null ? result.toString() : name;
}
 
Example #4
Source File: CommonAnnotationBeanPostProcessor.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
protected Object getResourceToInject(Object target, @Nullable String requestingBeanName) {
	if (StringUtils.hasLength(this.beanName)) {
		if (beanFactory != null && beanFactory.containsBean(this.beanName)) {
			// Local match found for explicitly specified local bean name.
			Object bean = beanFactory.getBean(this.beanName, this.lookupType);
			if (requestingBeanName != null && beanFactory instanceof ConfigurableBeanFactory) {
				((ConfigurableBeanFactory) beanFactory).registerDependentBean(this.beanName, requestingBeanName);
			}
			return bean;
		}
		else if (this.isDefaultName && !StringUtils.hasLength(this.mappedName)) {
			throw new NoSuchBeanDefinitionException(this.beanName,
					"Cannot resolve 'beanName' in local BeanFactory. Consider specifying a general 'name' value instead.");
		}
	}
	// JNDI name lookup - may still go to a local BeanFactory.
	return getResource(this, requestingBeanName);
}
 
Example #5
Source File: AbstractBeanFactory.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
	Assert.notNull(otherFactory, "BeanFactory must not be null");
	setBeanClassLoader(otherFactory.getBeanClassLoader());
	setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
	setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
	if (otherFactory instanceof AbstractBeanFactory) {
		AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
		this.customEditors.putAll(otherAbstractFactory.customEditors);
		this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
		this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
		this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
				otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
		this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
				otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
		this.scopes.putAll(otherAbstractFactory.scopes);
		this.securityContextProvider = otherAbstractFactory.securityContextProvider;
	}
	else {
		setTypeConverter(otherFactory.getTypeConverter());
	}
}
 
Example #6
Source File: BeanFactoryAspectInstanceFactory.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getAspectCreationMutex() {
	if (this.beanFactory != null) {
		if (this.beanFactory.isSingleton(name)) {
			// Rely on singleton semantics provided by the factory -> no local lock.
			return null;
		}
		else if (this.beanFactory instanceof ConfigurableBeanFactory) {
			// No singleton guarantees from the factory -> let's lock locally but
			// reuse the factory's singleton lock, just in case a lazy dependency
			// of our advice bean happens to trigger the singleton lock implicitly...
			return ((ConfigurableBeanFactory) this.beanFactory).getSingletonMutex();
		}
	}
	return this;
}
 
Example #7
Source File: AbstractBeanFactory.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException {
	String beanName = transformedBeanName(name);

	Object beanInstance = getSingleton(beanName, false);
	if (beanInstance != null) {
		return (beanInstance instanceof FactoryBean);
	}
	else if (containsSingleton(beanName)) {
		// null instance registered
		return false;
	}

	// No singleton instance found -> check bean definition.
	if (!containsBeanDefinition(beanName) && getParentBeanFactory() instanceof ConfigurableBeanFactory) {
		// No bean definition found in this factory -> delegate to parent.
		return ((ConfigurableBeanFactory) getParentBeanFactory()).isFactoryBean(name);
	}

	return isFactoryBean(beanName, getMergedLocalBeanDefinition(beanName));
}
 
Example #8
Source File: ParserStrategyUtils.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Invoke {@link BeanClassLoaderAware}, {@link BeanFactoryAware},
 * {@link EnvironmentAware}, and {@link ResourceLoaderAware} contracts
 * if implemented by the given object.
 */
public static void invokeAwareMethods(Object parserStrategyBean, Environment environment,
		ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {

	if (parserStrategyBean instanceof Aware) {
		if (parserStrategyBean instanceof BeanClassLoaderAware) {
			ClassLoader classLoader = (registry instanceof ConfigurableBeanFactory ?
					((ConfigurableBeanFactory) registry).getBeanClassLoader() : resourceLoader.getClassLoader());
			((BeanClassLoaderAware) parserStrategyBean).setBeanClassLoader(classLoader);
		}
		if (parserStrategyBean instanceof BeanFactoryAware && registry instanceof BeanFactory) {
			((BeanFactoryAware) parserStrategyBean).setBeanFactory((BeanFactory) registry);
		}
		if (parserStrategyBean instanceof EnvironmentAware) {
			((EnvironmentAware) parserStrategyBean).setEnvironment(environment);
		}
		if (parserStrategyBean instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) parserStrategyBean).setResourceLoader(resourceLoader);
		}
	}
}
 
Example #9
Source File: AbstractBeanFactory.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
/**
 * Return a 'merged' BeanDefinition for the given bean name,
 * merging a child bean definition with its parent if necessary.
 * <p>This {@code getMergedBeanDefinition} considers bean definition
 * in ancestors as well.
 * @param name the name of the bean to retrieve the merged definition for
 * (may be an alias)
 * @return a (potentially merged) RootBeanDefinition for the given bean
 * @throws NoSuchBeanDefinitionException if there is no bean with the given name
 * @throws BeanDefinitionStoreException in case of an invalid bean definition
 */
@Override
public BeanDefinition getMergedBeanDefinition(String name) throws BeansException {
	String beanName = transformedBeanName(name);

	// Efficiently check whether bean definition exists in this factory.
	if (!containsBeanDefinition(beanName) && getParentBeanFactory() instanceof ConfigurableBeanFactory) {
		return ((ConfigurableBeanFactory) getParentBeanFactory()).getMergedBeanDefinition(beanName);
	}
	// Resolve merged bean definition locally.
	return getMergedLocalBeanDefinition(beanName);
}
 
Example #10
Source File: AbstractBeanFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
	Assert.notNull(otherFactory, "BeanFactory must not be null");
	setBeanClassLoader(otherFactory.getBeanClassLoader());
	setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
	setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
	setConversionService(otherFactory.getConversionService());
	if (otherFactory instanceof AbstractBeanFactory) {
		AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
		this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
		this.customEditors.putAll(otherAbstractFactory.customEditors);
		this.typeConverter = otherAbstractFactory.typeConverter;
		this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
		this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
				otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
		this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
				otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
		this.scopes.putAll(otherAbstractFactory.scopes);
		this.securityContextProvider = otherAbstractFactory.securityContextProvider;
	}
	else {
		setTypeConverter(otherFactory.getTypeConverter());
		String[] otherScopeNames = otherFactory.getRegisteredScopeNames();
		for (String scopeName : otherScopeNames) {
			this.scopes.put(scopeName, otherFactory.getRegisteredScope(scopeName));
		}
	}
}
 
Example #11
Source File: BeanFactoryTypeConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
	if (beanFactory instanceof ConfigurableBeanFactory) {
		Object typeConverter = ((ConfigurableBeanFactory) beanFactory).getTypeConverter();
		if (typeConverter instanceof SimpleTypeConverter) {
			delegate = (SimpleTypeConverter) typeConverter;
		}
	}
}
 
Example #12
Source File: PluginConfig.java    From pf4j-spring-tutorial with MIT License 5 votes vote down vote up
private void registerMvcEndpoints(PluginManager pm) {
    pm.getExtensions(PluginInterface.class).stream()
            .flatMap(g -> g.mvcControllers().stream())
            .forEach(r -> ((ConfigurableBeanFactory) beanFactory)
                    .registerSingleton(r.getClass().getName(), r));
    applicationContext
            .getBeansOfType(RequestMappingHandlerMapping.class)
            .forEach((k, v) -> v.afterPropertiesSet());
}
 
Example #13
Source File: DisruptorEventAwareProcessor.java    From disruptor-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
/**
 * Delegate the creation of the access control context to the
 * {@link #setSecurityContextProvider SecurityContextProvider}.
 * @return {@link AccessControlContext} instance
 */
public AccessControlContext getAccessControlContext() {
	if(this.securityContextProvider != null){
		return  this.securityContextProvider.getAccessControlContext();
	}

	if(this.disruptorContext.getApplicationContext().getAutowireCapableBeanFactory() instanceof ConfigurableBeanFactory){
		ConfigurableBeanFactory beanFactory  =  (ConfigurableBeanFactory) this.disruptorContext.getApplicationContext().getAutowireCapableBeanFactory() ;
		return beanFactory.getAccessControlContext();
	}
	
	return AccessController.getContext();
}
 
Example #14
Source File: AbstractBeanFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a 'merged' BeanDefinition for the given bean name,
 * merging a child bean definition with its parent if necessary.
 * <p>This {@code getMergedBeanDefinition} considers bean definition
 * in ancestors as well.
 * @param name the name of the bean to retrieve the merged definition for
 * (may be an alias)
 * @return a (potentially merged) RootBeanDefinition for the given bean
 * @throws NoSuchBeanDefinitionException if there is no bean with the given name
 * @throws BeanDefinitionStoreException in case of an invalid bean definition
 */
@Override
public BeanDefinition getMergedBeanDefinition(String name) throws BeansException {
	String beanName = transformedBeanName(name);

	// Efficiently check whether bean definition exists in this factory.
	if (!containsBeanDefinition(beanName) && getParentBeanFactory() instanceof ConfigurableBeanFactory) {
		return ((ConfigurableBeanFactory) getParentBeanFactory()).getMergedBeanDefinition(beanName);
	}
	// Resolve merged bean definition locally.
	return getMergedLocalBeanDefinition(beanName);
}
 
Example #15
Source File: ExchangePropertyLanguageAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "exchangeProperty-language")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnMissingBean(ExchangePropertyLanguage.class)
public ExchangePropertyLanguage configureExchangePropertyLanguage()
        throws Exception {
    ExchangePropertyLanguage language = new ExchangePropertyLanguage();
    if (CamelContextAware.class.isAssignableFrom(ExchangePropertyLanguage.class)) {
        CamelContextAware contextAware = CamelContextAware.class
                .cast(language);
        if (contextAware != null) {
            contextAware.setCamelContext(camelContext);
        }
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, language,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (LanguageCustomizer<ExchangePropertyLanguage> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.exchangeproperty.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.exchangeproperty.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure language {}, with customizer {}",
                        language, customizer);
                customizer.customize(language);
            }
        }
    }
    return language;
}
 
Example #16
Source File: ConstantLanguageAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "constant-language")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnMissingBean(ConstantLanguage.class)
public ConstantLanguage configureConstantLanguage() throws Exception {
    ConstantLanguage language = new ConstantLanguage();
    if (CamelContextAware.class.isAssignableFrom(ConstantLanguage.class)) {
        CamelContextAware contextAware = CamelContextAware.class
                .cast(language);
        if (contextAware != null) {
            contextAware.setCamelContext(camelContext);
        }
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, language,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (LanguageCustomizer<ConstantLanguage> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.constant.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.constant.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure language {}, with customizer {}",
                        language, customizer);
                customizer.customize(language);
            }
        }
    }
    return language;
}
 
Example #17
Source File: JmsListenerEndpointRegistrar.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * A {@link BeanFactory} only needs to be available in conjunction with
 * {@link #setContainerFactoryBeanName}.
 */
@Override
public void setBeanFactory(BeanFactory beanFactory) {
	this.beanFactory = beanFactory;
	if (beanFactory instanceof ConfigurableBeanFactory) {
		this.mutex = ((ConfigurableBeanFactory) beanFactory).getSingletonMutex();
	}
}
 
Example #18
Source File: ZooKeeperServiceRegistryAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "zookeeper-service-registry")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public ZooKeeperServiceRegistry zookeeperServiceRegistry(ZooKeeperServiceRegistryConfiguration configuration) throws Exception {
    ZooKeeperServiceRegistry service = new ZooKeeperServiceRegistry();

    IntrospectionSupport.setProperties(
        service,
        IntrospectionSupport.getNonNullProperties(configuration)
    );

    return service;
}
 
Example #19
Source File: CommonAnnotationBeanPostProcessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Obtain a lazily resolving resource proxy for the given name and type,
 * delegating to {@link #getResource} on demand once a method call comes in.
 * @param element the descriptor for the annotated field/method
 * @param requestingBeanName the name of the requesting bean
 * @return the resource object (never {@code null})
 * @since 4.2
 * @see #getResource
 * @see Lazy
 */
protected Object buildLazyResourceProxy(final LookupElement element, final String requestingBeanName) {
	TargetSource ts = new TargetSource() {
		@Override
		public Class<?> getTargetClass() {
			return element.lookupType;
		}
		@Override
		public boolean isStatic() {
			return false;
		}
		@Override
		public Object getTarget() {
			return getResource(element, requestingBeanName);
		}
		@Override
		public void releaseTarget(Object target) {
		}
	};
	ProxyFactory pf = new ProxyFactory();
	pf.setTargetSource(ts);
	if (element.lookupType.isInterface()) {
		pf.addInterface(element.lookupType);
	}
	ClassLoader classLoader = (this.beanFactory instanceof ConfigurableBeanFactory ?
			((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader() : null);
	return pf.getProxy(classLoader);
}
 
Example #20
Source File: CglibSubclassingInstantiationStrategy.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create an enhanced subclass of the bean class for the provided bean
 * definition, using CGLIB.
 */
private Class<?> createEnhancedSubclass(RootBeanDefinition beanDefinition) {
	Enhancer enhancer = new Enhancer();
	enhancer.setSuperclass(beanDefinition.getBeanClass());
	enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
	if (this.owner instanceof ConfigurableBeanFactory) {
		ClassLoader cl = ((ConfigurableBeanFactory) this.owner).getBeanClassLoader();
		enhancer.setStrategy(new ClassLoaderAwareGeneratorStrategy(cl));
	}
	enhancer.setCallbackFilter(new MethodOverrideCallbackFilter(beanDefinition));
	enhancer.setCallbackTypes(CALLBACK_TYPES);
	return enhancer.createClass();
}
 
Example #21
Source File: PersistenceAnnotationBeanPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Find an EntityManagerFactory with the given name in the current
 * Spring application context.
 * @param unitName the name of the persistence unit (never empty)
 * @param requestingBeanName the name of the requesting bean
 * @return the EntityManagerFactory
 * @throws NoSuchBeanDefinitionException if there is no such EntityManagerFactory in the context
 */
protected EntityManagerFactory findNamedEntityManagerFactory(String unitName, @Nullable String requestingBeanName)
		throws NoSuchBeanDefinitionException {

	Assert.state(this.beanFactory != null, "ListableBeanFactory required for EntityManagerFactory bean lookup");

	EntityManagerFactory emf = EntityManagerFactoryUtils.findEntityManagerFactory(this.beanFactory, unitName);
	if (requestingBeanName != null && this.beanFactory instanceof ConfigurableBeanFactory) {
		((ConfigurableBeanFactory) this.beanFactory).registerDependentBean(unitName, requestingBeanName);
	}
	return emf;
}
 
Example #22
Source File: JndiObjectFactoryBean.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void setBeanFactory(BeanFactory beanFactory) {
	if (beanFactory instanceof ConfigurableBeanFactory) {
		// Just optional - for getting a specifically configured TypeConverter if needed.
		// We'll simply fall back to a SimpleTypeConverter if no specific one available.
		this.beanFactory = (ConfigurableBeanFactory) beanFactory;
	}
}
 
Example #23
Source File: AspectJExpressionPointcut.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine the ClassLoader to use for pointcut evaluation.
 */
@Nullable
private ClassLoader determinePointcutClassLoader() {
	if (this.beanFactory instanceof ConfigurableBeanFactory) {
		return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader();
	}
	if (this.pointcutDeclarationScope != null) {
		return this.pointcutDeclarationScope.getClassLoader();
	}
	return ClassUtils.getDefaultClassLoader();
}
 
Example #24
Source File: CglibSubclassingInstantiationStrategy.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create an enhanced subclass of the bean class for the provided bean
 * definition, using CGLIB.
 */
private Class<?> createEnhancedSubclass(RootBeanDefinition beanDefinition) {
	Enhancer enhancer = new Enhancer();
	enhancer.setSuperclass(beanDefinition.getBeanClass());
	enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
	if (this.owner instanceof ConfigurableBeanFactory) {
		ClassLoader cl = ((ConfigurableBeanFactory) this.owner).getBeanClassLoader();
		enhancer.setStrategy(new ClassLoaderAwareGeneratorStrategy(cl));
	}
	enhancer.setCallbackFilter(new MethodOverrideCallbackFilter(beanDefinition));
	enhancer.setCallbackTypes(CALLBACK_TYPES);
	return enhancer.createClass();
}
 
Example #25
Source File: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public InternalQueryBean internalQueryBean(){
    logger.trace("Creating an instance of " + InternalQueryBean.class.getSimpleName());

    return new InternalQueryBean();
}
 
Example #26
Source File: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean(name = "Version1to2")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public Version1to2 version1to2() { // stateless/stateful bean
    logger.trace("Creating an instance of Version1to2");

    return new Version1to2();
}
 
Example #27
Source File: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean(name = "IntType")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public IntConverter intConverter() { // stateless/stateful factory patterned bean
    logger.trace("Creating an instance of IntConverter");

    return new IntConverter();
}
 
Example #28
Source File: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public TriggerExecutorBean triggerExecutorBean() {
    logger.trace("creating an instance of TriggerExecutorBean");

    return new TriggerExecutorBean();
}
 
Example #29
Source File: DolphinPlatformSpringTestBootstrap.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
protected TestConfiguration createTestConfiguration(final WebApplicationContext context, final HttpSession httpSession) {
    Assert.requireNonNull(context, "context");
    try {
        return new TestConfiguration(context, httpSession);
    } catch (Exception e) {
        throw new RuntimeException("Can not create test configuration", e);
    }
}
 
Example #30
Source File: Application.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Bean(name = "verifier-context", initMethod = "start", destroyMethod = "stop")
public static CamelContext verifierContext() {
    CamelContext context = new DefaultCamelContext();
    context.setNameStrategy(new ExplicitCamelContextNameStrategy("verifier-context"));
    context.disableJMX();

    return context;
}