Java Code Examples for org.springframework.beans.factory.config.ConfigurableBeanFactory#SCOPE_SINGLETON
The following examples show how to use
org.springframework.beans.factory.config.ConfigurableBeanFactory#SCOPE_SINGLETON .
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: AtomixClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 6 votes |
@Bean(name = "atomix-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) @ConditionalOnProperty(prefix = "camel.component.atomix.cluster.service", name = "mode", havingValue = "node") public CamelClusterService atomixClusterService() { AtomixClusterService service = new AtomixClusterService(); service.setNodes(configuration.getNodes().stream().map(Address::new).collect(Collectors.toList())); ObjectHelper.ifNotEmpty(configuration.isEphemeral(), service::setEphemeral); ObjectHelper.ifNotEmpty(configuration.getId(), service::setId); ObjectHelper.ifNotEmpty(configuration.getAddress(), service::setAddress); ObjectHelper.ifNotEmpty(configuration.getStoragePath(), service::setStoragePath); ObjectHelper.ifNotEmpty(configuration.getStorageLevel(), service::setStorageLevel); ObjectHelper.ifNotEmpty(configuration.getConfigurationUri(), service::setConfigurationUri); ObjectHelper.ifNotEmpty(configuration.getAttributes(), service::setAttributes); ObjectHelper.ifNotEmpty(configuration.getOrder(), service::setOrder); return service; }
Example 2
Source File: RuntimeBeanManager.java From Redis-Synyed with Apache License 2.0 | 6 votes |
/** * 运行时创建Spring代理bean工厂类 */ @Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public RuntimeBeanFactory runtimeBeanFactory() { return new RuntimeBeanFactory() { /* * @see com.wmz7year.synyed.net.spi.RuntimeBeanFactory# * createRuntimeProtocolSyncWorker() */ @Override public ProtocolSyncWorker createRuntimeProtocolSyncWorker() { return createProtocolSyncWorker(); } }; }
Example 3
Source File: AtomixClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "atomix-cluster-client-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) @ConditionalOnProperty(prefix = "camel.component.atomix.cluster.service", name = "mode", havingValue = "client") public CamelClusterService atomixClusterClientService() { AtomixClusterClientService service = new AtomixClusterClientService(); service.setNodes(configuration.getNodes().stream().map(Address::new).collect(Collectors.toList())); ObjectHelper.ifNotEmpty(configuration.getId(), service::setId); ObjectHelper.ifNotEmpty(configuration.getConfigurationUri(), service::setConfigurationUri); ObjectHelper.ifNotEmpty(configuration.getAttributes(), service::setAttributes); ObjectHelper.ifNotEmpty(configuration.getOrder(), service::setOrder); return service; }
Example 4
Source File: JGroupsLockClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "jgroups-lock-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public CamelClusterService zookeeperClusterService() throws Exception { JGroupsLockClusterService service = new JGroupsLockClusterService(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 5
Source File: KubernetesClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "kubernetes-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public CamelClusterService kubernetesClusterService() throws Exception { KubernetesClusterService service = new KubernetesClusterService(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 6
Source File: ZooKeeperServiceRegistryAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@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 7
Source File: ZooKeeperClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "zookeeper-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public CamelClusterService zookeeperClusterService() throws Exception { ZooKeeperClusterService service = new ZooKeeperClusterService(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 8
Source File: ConsulServiceRegistryAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "consul-service-registry") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public ConsulServiceRegistry consulServiceRegistry(ConsulServiceRegistryConfiguration configuration) throws Exception { ConsulServiceRegistry service = new ConsulServiceRegistry(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 9
Source File: ConsulClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "consul-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public CamelClusterService consulClusterService() throws Exception { ConsulClusterService service = new ConsulClusterService(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 10
Source File: JGroupsRaftClusterServiceAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "jgroups-raft-cluster-service") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public CamelClusterService jgroupsRaftClusterService() throws Exception { JGroupsRaftClusterService service = new JGroupsRaftClusterService(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; }
Example 11
Source File: RabbitMQConfig.java From rome with Apache License 2.0 | 5 votes |
@Bean("rabbitTemplate") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory, @Qualifier("jackson2JsonMessageConverter") Jackson2JsonMessageConverter jackson2JsonMessageConverter) { RabbitTemplate template = new RabbitTemplate(connectionFactory); template.setMessageConverter(new Jackson2JsonMessageConverter()); return template; }
Example 12
Source File: EngineBeanConfig.java From db with GNU Affero General Public License v3.0 | 5 votes |
@Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public GlobalLiveStore globalLiveStore() { // stateless/stateful bean logger.trace("Creating an instance of GlobalLiveStore"); return new GlobalLiveStore(); }
Example 13
Source File: Application.java From syndesis with Apache License 2.0 | 5 votes |
@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; }
Example 14
Source File: CoreAppConfig.java From logsniffer with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns a general properties placeholder configurer based on * {@link #logSnifferProperties()}. * * @param props * autowired logSnifferProperties bean * @return A general properties placeholder configurer. * @throws IOException */ @Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) @Autowired public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer( @Qualifier(BEAN_LOGSNIFFER_PROPS) final Properties props) throws IOException { final PropertyPlaceholderConfigurer c = new PropertyPlaceholderConfigurer(); c.setIgnoreResourceNotFound(true); c.setIgnoreUnresolvablePlaceholders(true); c.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); c.setProperties(props); return c; }
Example 15
Source File: DolphinPlatformSpringTestBootstrap.java From dolphin-platform with Apache License 2.0 | 4 votes |
@Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) protected TestClientContext createClientContext(final TestConfiguration testConfiguration) { Assert.requireNonNull(testConfiguration, "testConfiguration"); return testConfiguration.getClientContext(); }
Example 16
Source File: DolphinPlatformSpringTestBootstrap.java From dolphin-platform with Apache License 2.0 | 4 votes |
@Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) protected DolphinContext createServerContext(final TestConfiguration testConfiguration) { Assert.requireNonNull(testConfiguration, "testConfiguration"); return testConfiguration.getDolphinTestContext(); }
Example 17
Source File: TeiidAutoConfiguration.java From teiid-spring-boot with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public SpringSecurityHelper securityHelper() { return new SpringSecurityHelper(); }
Example 18
Source File: DolphinPlatformSpringTestBootstrap.java From dolphin-platform with Apache License 2.0 | 4 votes |
@Bean(name = "dolphinSession") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) protected ClientSession createDolphinSession(final TestConfiguration testConfiguration) { Assert.requireNonNull(testConfiguration, "testConfiguration"); return testConfiguration.getDolphinTestContext().getClientSession(); }
Example 19
Source File: DolphinPlatformSpringTestBootstrap.java From dolphin-platform with Apache License 2.0 | 4 votes |
@Bean(name = "remotingContext") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) protected RemotingContext createRemotingContext(final TestConfiguration testConfiguration, final PropertyBinder propertyBinder, final RemotingEventBus eventBus) { Assert.requireNonNull(testConfiguration, "testConfiguration"); Assert.requireNonNull(propertyBinder, "propertyBinder"); Assert.requireNonNull(eventBus, "eventBus"); return new RemotingContext() { @Override public String getId() { return testConfiguration.getDolphinTestContext().getClientSession().getId(); } @Override public ClientSessionExecutor createSessionExecutor() { return new ClientSessionExecutorImpl(new Executor() { @Override public void execute(Runnable command) { testConfiguration.getDolphinTestContext().runLater(command); } }); } @Override public PropertyBinder getBinder() { return propertyBinder; } @Override public BeanManager getBeanManager() { return testConfiguration.getDolphinTestContext().getBeanManager(); } @Override public RemotingEventBus getEventBus() { return eventBus; } @Override public ClientSession getClientSession() { return testConfiguration.getDolphinTestContext().getClientSession(); } @Override public boolean isActive() { return true; } }; }
Example 20
Source File: DolphinPlatformSpringTestBootstrap.java From dolphin-platform with Apache License 2.0 | 4 votes |
@Bean(name = "propertyBinder") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) protected PropertyBinder createPropertyBinder() { return new PropertyBinderImpl(); }