List of usage examples for org.springframework.beans.factory.config ConfigurableBeanFactory SCOPE_SINGLETON
String SCOPE_SINGLETON
To view the source code for org.springframework.beans.factory.config ConfigurableBeanFactory SCOPE_SINGLETON.
Click Source Link
From source file:org.teiid.spring.autoconfigure.TeiidAutoConfiguration.java
@Bean(name = "teiid") @ConditionalOnMissingBean// www. java 2s.c o m @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public TeiidServer teiidServer() { logger.info("Starting Teiid Server."); // turning off PostgreSQL support System.setProperty("org.teiid.addPGMetadata", "false"); final TeiidServer server = new TeiidServer(); if (embeddedConfiguration == null) { embeddedConfiguration = new EmbeddedConfiguration(); embeddedConfiguration.setCacheFactory(new CacheFactory() { @Override public <K, V> Cache<K, V> get(String name) { return new LocalCache<>(name, 10); } @Override public void destroy() { } }); // add ability for remote jdbc connections if (this.properties.isJdbcEnable()) { SocketConfiguration sc = new SocketConfiguration(); sc.setPortNumber(this.properties.getJdbcPort()); sc.setProtocol(WireProtocol.teiid); embeddedConfiguration.addTransport(sc); } if (this.properties.isOdbcEnable()) { SocketConfiguration sc = new SocketConfiguration(); sc.setPortNumber(this.properties.getOdbcPort()); sc.setProtocol(WireProtocol.pg); embeddedConfiguration.addTransport(sc); } } if (embeddedConfiguration.getTransactionManager() == null) { PlatformTransactionManagerAdapter ptma = server.getPlatformTransactionManagerAdapter(); ptma.setJTATransactionManager(this.transactionManager); embeddedConfiguration.setTransactionManager(ptma); } server.start(embeddedConfiguration); // this is dummy vdb to satisfy the boot process to create the connections VDBMetaData vdb = new VDBMetaData(); vdb.setName(VDBNAME); vdb.setVersion(VDBVERSION); server.deployVDB(vdb, false); serverContext.set(server); return server; }