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.integrationtest.mule.MuleSuccessfulOneTaskTestConfiguration.java

/**
 * Override./*from  ww  w . j  av a 2 s . c  o  m*/
 * Location of connector and transport service configuration files
 * for the Mule implementation of the transport service.<br/>
 * Do not include the file containing JMS connector(s), since
 * the tests will use an embedded ActiveMQ broker with an associated
 * JMS connector defined in a special file.
 *
 * @return List of locations where the Mule transport service is to
 * search for configuration files.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public List<String> muleTransportServiceConfigLocations() {
    final List<String> theLocationsList = new ArrayList<String>();
    theLocationsList.add("classpath:connectors/mule/file-connectors.xml");
    return theLocationsList;
}

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

/**
 * Quartz scheduler./*from   w w  w.ja  v  a2s  . c  o  m*/
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public SchedulerFactoryBean quartzScheduler() {
    final SchedulerFactoryBean theQuartzSchedulerFactory = new SchedulerFactoryBean();
    return theQuartzSchedulerFactory;
}

From source file:se.ivankrizsan.messagecowboy.integrationtest.camel.CamelTestSuccessfulOneTaskConfiguration.java

/**
 * Override.//from   w w w.  j av a 2 s .  c o m
 * Location of connector and transport service configuration files
 * for the Camel implementation of the transport service.<br/>
 * Do not include the file containing JMS connector(s), since
 * the tests will use an embedded ActiveMQ broker with an associated
 * JMS connector defined in a special file.
 * 
 * @return List of locations where the Camel transport service is to
 * search for configuration files.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public List<String> camelTransportServiceConfigLocations() {
    final List<String> theLocationsList = new ArrayList<String>();
    theLocationsList.add("classpath:connectors/camel/file-connectors.xml");
    return theLocationsList;
}

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

/**
 * Override.//from  w ww  . j a v a2  s .c  o m
 * Location of connector and transport service configuration files
 * for the Camel implementation of the transport service.<br/>
 * Test configuration.
 * 
 * @return List of locations where the Camel transport service is to
 * search for configuration files.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public List<String> camelTransportServiceConfigLocations() {
    final List<String> theLocationsList = new ArrayList<String>();
    theLocationsList.add("classpath:connectors/camel/jms-connector-with-embedded-amq.xml");

    return theLocationsList;
}

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

/**
 * Override./*from  w  w  w . j a v a2s .  c o m*/
 * Location of connector and transport service configuration files
 * for the Mule implementation of the transport service.<br/>
 * Test configuration.
 *
 * @return List of locations where the Mule transport service is to
 * search for configuration files.
 */
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public List<String> muleTransportServiceConfigLocations() {
    final List<String> theLocationsList = new ArrayList<String>();
    theLocationsList.add("classpath:connectors/mule/file-connectors.xml");
    theLocationsList.add("classpath:connectors/mule/jms-connector-with-embedded-amq.xml");
    theLocationsList.add("classpath*:transport-service-configurations/*.xml");

    return theLocationsList;
}

From source file:com.alliander.osgp.acceptancetests.config.messaging.ProtocolOslpMessagingConfig.java

@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
public DefaultMessageListenerContainer oslpRequestsMessageListenerContainer() {
    final DefaultMessageListenerContainer messageListenerContainer = new DefaultMessageListenerContainer();
    messageListenerContainer.setConnectionFactory(MessagingConfig.pooledConnectionFactory());
    messageListenerContainer.setDestination(this.oslpRequestsQueue());
    messageListenerContainer.setConcurrentConsumers(MessagingConfig.CONCURRENT_CONSUMERS);
    messageListenerContainer.setMaxConcurrentConsumers(MessagingConfig.MAX_CONCURRENT_CONSUMERS);
    messageListenerContainer.setMessageListener(this.deviceRequestMessageListener);
    messageListenerContainer.setSessionTransacted(true);
    return messageListenerContainer;
}

From source file:org.agatom.springatom.data.xml.OXMLConfiguration.java

@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public XMLHelper getOXMEngine() {
    final OXMLEngine engine = new OXMLEngine();
    engine.setMarshaller(this.getJaxbMarshaller());
    engine.setUnmarshaller(this.getJaxbMarshaller());
    return engine;
}

From source file:se.ivankrizsan.messagecowboy.services.starter.MessageCowboyStarterServiceConfiguration.java

/**
 * Service that starts and stops the Message Cowboy application.
 *
 * @return Service instance./*  w w  w . j  a  va2 s  .  c o  m*/
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public MessageCowboyStarterService starterService() {
    final MessageCowboyStarterServiceImpl theService = new MessageCowboyStarterServiceImpl();
    /* Set a default task refresh interval. */
    theService.setTaskReschedulingCronExpression("0 0/2 * * * ?");
    theService.setTasksNotToUnschedule(retrieveTaskNotToUnscheduleTaskKeys());
    /* Set a default transport service configuration refresh interval. */
    theService.setTransportServiceConfigurationRefreshCronExpression("0 0/2 * * * ?");
    /* Set cleanup interval and number of days to retain reports for task execution status reports cleanup. */
    theService.setTaskExecutionStatusCleanupCronExpression("* 0/2 * * * ?");
    theService.setTaskExecutionStatusMaxAgeInDays(Integer.parseInt(taskExecutionStatusDaysToKeep));
    return theService;
}

From source file:io.redlink.solrlib.spring.boot.autoconfigure.SolrLibEmbeddedAutoconfiguration.java

@Bean(initMethod = "initialize", destroyMethod = "shutdown")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@ConditionalOnMissingBean(SolrCoreContainer.class)
public SolrCoreContainer embeddedSolrCoreContainer() {
    log.debug("Creating embeddedSolrCoreContainer");
    final EmbeddedCoreContainerConfiguration config = new EmbeddedCoreContainerConfiguration();

    Path solrHome = props.getHome();
    if (solrHome == null) {
        try {//www.j  a v  a2  s  .  c  o m
            solrHome = Files.createTempDirectory("solrlib");
            log.warn("No solrlib.home provided, creating tempdir {}", solrHome);
        } catch (IOException e) {
            throw new IllegalStateException("Could not create temp-dir as solr home", e);
        }
    }
    config.setHome(solrHome);
    config.setDeleteOnShutdown(props.isDeleteOnShutdown());

    return new EmbeddedCoreContainer(coreDescriptors, config);
}

From source file:io.redlink.solrlib.spring.boot.autoconfigure.SolrLibStandaloneAutoconfiguration.java

@Primary
@Bean(initMethod = "initialize", destroyMethod = "shutdown")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@ConditionalOnClass(SolrServerConnector.class)
@ConditionalOnProperty({ "solrlib.base-url" })
@ConditionalOnMissingBean(SolrCoreContainer.class)
public SolrCoreContainer solrServerConnector() {
    log.debug("Creating solrServerConnector");
    final SolrServerConnectorConfiguration config = new SolrServerConnectorConfiguration();
    config.setSolrUrl(props.getBaseUrl());
    config.setSolrHome(props.getHome());
    config.setPrefix(props.getCollectionPrefix());
    config.setDeployCores(props.isDeployCores());

    return new SolrServerConnector(coreDescriptors, config);
}