Example usage for org.springframework.beans.factory.config ConfigurableBeanFactory SCOPE_SINGLETON

List of usage examples for org.springframework.beans.factory.config ConfigurableBeanFactory SCOPE_SINGLETON

Introduction

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

Prototype

String SCOPE_SINGLETON

To view the source code for org.springframework.beans.factory.config ConfigurableBeanFactory SCOPE_SINGLETON.

Click Source Link

Document

Scope identifier for the standard singleton scope: "singleton".

Usage

From source file:se.ivankrizsan.messagecowboy.ProductionPropertyOverrides.java

/**
 * Overrides properties configured on beans.
 *///from  ww  w .j  a  v  a  2  s.  c o m
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
    PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();

    final Properties thePropertiesHolder = new Properties();
    /* Task refresh interval. */
    thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "0/20 * * * * ?");
    /* Transport service configuration refresh interval. */
    thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression",
            "0/30 * * * * ?");
    /* Task execution status reports cleanup interval. */
    thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/30 0/15 * * * ?");

    theOverrideConfigurer.setProperties(thePropertiesHolder);
    theOverrideConfigurer.setIgnoreInvalidKeys(false);
    theOverrideConfigurer.setIgnoreResourceNotFound(false);
    theOverrideConfigurer.setOrder(0);
    return theOverrideConfigurer;
}

From source file:de.neusta.examples.passwordvalidator.AppConfig.java

@Bean(name = { "passwordService" })
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public PasswordService passwordService() {
    return new PasswordService();
}

From source file:se.ivankrizsan.messagecowboy.services.scheduling.SchedulingServiceConfiguration.java

/**
 * Scheduling service implemented using Quartz.
 *///from ww  w. j  a  v  a2  s. co m
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public SchedulingService schedulingService() {
    final QuartzSchedulingService theService = new QuartzSchedulingService();
    theService.setQuartzSchedulerHelper(quartzSchedulerHelper());

    return theService;
}

From source file:org.obiba.mica.config.EsConcurrencyConfiguration.java

@Bean(name = "esJoinQueriesSemaphore")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public Semaphore getSemaphore() {
    return new Semaphore(propertyResolver.getProperty("maxConcurrentJoinQueries", Integer.class,
            DEFAULT_MAX_CONCURRENT_MAX_JOIN_QUERIES));
}

From source file:se.ivankrizsan.messagecowboy.services.transport.CamelTransportServiceTestConfiguration.java

/**
 * Transport service, Camel implementation.
 * In this test configuration, the transport service is not started
 * and stopped automatically./*from www.  j  a  va2 s . c  o m*/
 * 
 * @return Service instance.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public TransportService transportService() {
    final CamelTransportService theService = new CamelTransportService();
    theService.setConnectorsResourcesLocationPattern(camelTransportServiceConfigLocations());

    return theService;
}

From source file:se.ivankrizsan.messagecowboy.services.transport.MuleTransportServiceTestConfiguration.java

/**
 * Transport service, Mule implementation.
 * In this test configuration, the transport service is not started
 * and stopped automatically./*from   w ww.j  ava  2s  . c  om*/
 *
 * @return Service instance.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public TransportService transportService() {
    final MuleTransportService theService = new MuleTransportService();
    theService.setConnectorsResourcesLocationPattern(muleTransportServiceConfigLocations());

    return theService;
}

From source file:se.ivankrizsan.messagecowboy.services.taskconfiguration.TaskConfigurationServiceConfiguration.java

/**
 * Service that stores and retrieves task configurations.
 *//*from w w w  .  j  a v  a 2  s.  co  m*/
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public TaskConfigurationService taskConfigurationService() {
    final TaskConfigurationServiceImpl theService = new TaskConfigurationServiceImpl();
    theService.setTaskConfigurationRepository(taskConfigurationRepository);

    return theService;
}

From source file:se.ivankrizsan.messagecowboy.services.taskexecutionstatus.TaskExecutionStatusServiceConfiguration.java

/**
 * Service that stores and retrieves task execution status information.
 *///from  w  w w . j av a 2 s.c  o m
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public TaskExecutionStatusService taskExecutionStatusService() {
    final TaskExecutionStatusServiceImpl theService = new TaskExecutionStatusServiceImpl();
    theService.setTaskExecutionStatusRepository(taskExecutionStatusRepository);

    return theService;
}

From source file:se.ivankrizsan.messagecowboy.services.scheduling.SchedulingServiceConfiguration.java

/**
 * Scheduling service Quartz implementation helper bean.
 *///ww w. ja  v  a 2  s  .c  om
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public QuartzSchedulerHelper quartzSchedulerHelper() {
    final QuartzSchedulerHelper theHelper = new QuartzSchedulerHelper();
    theHelper.setWaitForRunningJobsToCompleteAtShutdown(true);

    return theHelper;
}

From source file:se.ivankrizsan.messagecowboy.services.transport.TransportServiceConfiguration.java

/**
 * Transport service implementation.// www  . j  a  v a 2 s . c o  m
 * 
 * @return Service instance.
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public TransportService transportService() {
    LOGGER.info("messagecowboy.transport set to {}", mTransportType);

    if (CAMEL_TRANSPORT_TYPE.equals(mTransportType)) {
        final CamelTransportService theService = new CamelTransportService();
        theService.setConnectorsResourcesLocationPattern(camelTransportServiceConfigLocations());
        return theService;
    } else {
        final MuleTransportService theService = new MuleTransportService();
        theService.setConnectorsResourcesLocationPattern(muleTransportServiceConfigLocations());
        return theService;
    }

}