Java Code Examples for org.springframework.beans.factory.config.ConfigurableBeanFactory#SCOPE_PROTOTYPE

The following examples show how to use org.springframework.beans.factory.config.ConfigurableBeanFactory#SCOPE_PROTOTYPE . 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: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public AlterTableExecutor alterTableExecutor() { // stateless/stateful bean
    logger.trace("Creating an instance of AlterTableExecutor");

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

    return new ClusterMessaging();
}
 
Example 3
Source File: ElasticSearchAppConfig.java    From logsniffer with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Autowired
public ElasticClientTemplate clientTemplate(final EsSettingsHolder settingsHolder) {
	return new ElasticClientTemplate() {
		@Override
		public <T> T executeWithClient(final ClientCallback<T> callback) {
			final Client c = getClientConnection(settingsHolder.getSettings()).getClient();
			return callback.execute(c);
		}
	};
}
 
Example 4
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 OnDiskDistinctHandling onDiskDistinctHandling(){
    logger.trace("Creating an instance of " + OnDiskDistinctHandling.class.getSimpleName());

    return new OnDiskDistinctHandling();
}
 
Example 5
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 HookableTransaction hookeableTransaction(){
    logger.trace("Creating an instance of " + HookableTransactionBean.class.getSimpleName());

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

    return new Version3to4();
}
 
Example 7
Source File: EngineBeanConfig.java    From db with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean(name = "SelectActivityLog")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public SelectActivityLog selectActivityLog() {
    logger.trace("Creating an instance of SelectActivityLog");

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

    return new CsvImporter();
}
 
Example 9
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 IndexFactory indexFactory() { // stateless/stateful bean
    logger.trace("Creating an instance of IndexFactory");

    return new IndexFactory();
}
 
Example 10
Source File: RabbitTemplateConfig.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//必须是prototype类型
public RabbitTemplate rabbitTemplate() {
    RabbitTemplate template = new RabbitTemplate(connectionFactory());
    return template;
}
 
Example 11
Source File: SpelLanguageAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "spel-language")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnMissingBean(SpelLanguage.class)
public SpelLanguage configureSpelLanguage() throws Exception {
    SpelLanguage language = new SpelLanguage();
    if (CamelContextAware.class.isAssignableFrom(SpelLanguage.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<SpelLanguage> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.spel.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.spel.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure language {}, with customizer {}",
                        language, customizer);
                customizer.customize(language);
            }
        }
    }
    return language;
}
 
Example 12
Source File: XMLTokenizeLanguageAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean(name = "xtokenize-language")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnMissingBean(XMLTokenizeLanguage.class)
public XMLTokenizeLanguage configureXMLTokenizeLanguage() throws Exception {
    XMLTokenizeLanguage language = new XMLTokenizeLanguage();
    if (CamelContextAware.class.isAssignableFrom(XMLTokenizeLanguage.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<XMLTokenizeLanguage> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.xtokenize.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.language.customizer",
                            "camel.language.xtokenize.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure language {}, with customizer {}",
                        language, customizer);
                customizer.customize(language);
            }
        }
    }
    return language;
}
 
Example 13
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 RowCountManager rowCountManager() { // stateless/stateful bean
    logger.trace("Creating an instance of RowCountManager");

    return new RowCountManager();
}
 
Example 14
Source File: MyConfiguration.java    From Spring-Boot-2-Fundamentals with MIT License 4 votes vote down vote up
/**
 * Every Bean that has a dependency on "myDate" will get its own
 * instance containing the timestamp of its instantiation
 */
@Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public Date myDate(){
    return new Date();
}
 
Example 15
Source File: CiCdAutoConfiguration.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public RktNativePipeDeployer rktNativePipeDeployer(RktNativePipelineProvider provider, AppInstance instance,
												   List<PipelineHistoryInstance> pipelineHistoryInstances) {
	return new RktNativePipeDeployer(provider, instance, pipelineHistoryInstances);
}
 
Example 16
Source File: EnodeAutoConfiguration.java    From enode with MIT License 4 votes vote down vote up
@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public MessageHandlerProxy1 messageHandlerProxy1() {
    return new MessageHandlerProxy1();
}
 
Example 17
Source File: MyConfiguration.java    From Spring-Boot-2-Fundamentals with MIT License 4 votes vote down vote up
/**
 * Every Bean that has a dependency on "myDate" will get its own
 * instance containing the timestamp of its instantiation
 */
@Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public Date myDate(){
    return new Date();
}
 
Example 18
Source File: EnodeAutoConfiguration.java    From enode with MIT License 4 votes vote down vote up
/**
 * 原型模式获取bean,每次新建代理执行
 */
@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public CommandHandlerProxy commandHandlerProxy() {
    return new CommandHandlerProxy();
}
 
Example 19
Source File: CiCdAutoConfiguration.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public DockerNativePipeDeployer dockerNativePipeDeployer(PipelineProvider provider, AppInstance instance,
														 List<PipelineHistoryInstance> pipelineHistoryInstances) {
	return new DockerNativePipeDeployer(provider, instance, pipelineHistoryInstances);
}
 
Example 20
Source File: MetricsSlackProcessorBeanFactory.java    From SkaETL with Apache License 2.0 4 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public MetricsSlackProcessor slackProcessor(String webhook) {
    return new MetricsSlackProcessor(webhook, null);
}