当前位置: 首页>>代码示例>>Java>>正文


Java SingletonServiceFactory.getBean方法代码示例

本文整理汇总了Java中com.networknt.service.SingletonServiceFactory.getBean方法的典型用法代码示例。如果您正苦于以下问题:Java SingletonServiceFactory.getBean方法的具体用法?Java SingletonServiceFactory.getBean怎么用?Java SingletonServiceFactory.getBean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.networknt.service.SingletonServiceFactory的用法示例。


在下文中一共展示了SingletonServiceFactory.getBean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TestServer

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
private TestServer() {
    DataSource ds = (DataSource) SingletonServiceFactory.getBean(DataSource.class);
    try (Connection connection = ds.getConnection()) {
        String schemaResourceName = "/create_h2.sql";
        InputStream in = TestServer.class.getResourceAsStream(schemaResourceName);

        if (in == null) {
            throw new RuntimeException("Failed to load resource: " + schemaResourceName);
        }
        InputStreamReader reader = new InputStreamReader(in, UTF_8);
        RunScript.execute(connection, reader);

    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:networknt,项目名称:light-oauth2,代码行数:17,代码来源:TestServer.java

示例2: TestServer

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
private TestServer() {
    DataSource ds = (DataSource) SingletonServiceFactory.getBean(DataSource.class);
    try (Connection connection = ds.getConnection()) {
        String schemaResourceName = "/create_h2.sql";
        InputStream in = TestServer.class.getResourceAsStream(schemaResourceName);

        if (in == null) {
            throw new RuntimeException("Failed to load resource: " + schemaResourceName);
        }
        InputStreamReader reader = new InputStreamReader(in, UTF_8);
        RunScript.execute(connection, reader);

    } catch (SQLException e) {
        e.printStackTrace();
    }

}
 
开发者ID:networknt,项目名称:light-oauth2,代码行数:18,代码来源:TestServer.java

示例3: TestServer

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
private TestServer() {
    DataSource ds = (DataSource) SingletonServiceFactory.getBean(DataSource.class);
    try (Connection connection = ds.getConnection()) {
        // Runscript doesn't work need to execute batch here.
        String schemaResourceName = "/create_h2.sql";
        InputStream in = TestServer.class.getResourceAsStream(schemaResourceName);

        if (in == null) {
            throw new RuntimeException("Failed to load resource: " + schemaResourceName);
        }
        InputStreamReader reader = new InputStreamReader(in, UTF_8);
        RunScript.execute(connection, reader);

    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:networknt,项目名称:light-oauth2,代码行数:18,代码来源:TestServer.java

示例4: runOnceBeforeClass

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
@BeforeClass
public static void runOnceBeforeClass() {
    System.out.println("@BeforeClass - runOnceBeforeClass");
    DataSource ds = (DataSource) SingletonServiceFactory.getBean(DataSource.class);
    try (Connection connection = ds.getConnection()) {
        String schemaResourceName = "/create_h2.sql";
        InputStream in = CacheStartupHookProviderTest.class.getResourceAsStream(schemaResourceName);

        if (in == null) {
            throw new RuntimeException("Failed to load resource: " + schemaResourceName);
        }
        InputStreamReader reader = new InputStreamReader(in, UTF_8);
        RunScript.execute(connection, reader);

    } catch (SQLException e) {
        e.printStackTrace();
    }

}
 
开发者ID:networknt,项目名称:light-oauth2,代码行数:20,代码来源:CacheStartupHookProviderTest.java

示例5: setUp

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
@Before
public void setUp() {
  myReplyConsumer = SingletonServiceFactory.getBean(MyReplyConsumer.class);
  logger.debug("myReplyConsumer = " + myReplyConsumer);
  commandProducer = SingletonServiceFactory.getBean(CommandProducer.class);
  logger.debug("commandProducer = " + commandProducer);
  myTestCommandHandler = SingletonServiceFactory.getBean(MyTestCommandHandler.class);
  logger.debug("myTestCommandHandler = " + myTestCommandHandler);
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:10,代码来源:TramCommandsAndEventsIntegrationIT.java

示例6: consumerCommandDispatcher

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public CommandDispatcher consumerCommandDispatcher() {
    MyTestCommandHandler target = Mockito.spy(new MyTestCommandHandler());
    ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
    MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
    MessageProducer messageProducer = SingletonServiceFactory.getBean(MessageProducer.class);
    return new CommandDispatcher("customerCommandDispatcher",
            target.defineCommandHandlers(), channelMapping, messageConsumer, messageProducer);
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:9,代码来源:TramCommandsAndEventsServiceInitializer.java

示例7: getCustomerCommandDispatcher

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public static CommandDispatcher getCustomerCommandDispatcher() {
    CustomerCommandHandler customerCommandHandler = SingletonServiceFactory.getBean(CustomerCommandHandler.class);
    ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
    MessageProducer messageProducer =  SingletonServiceFactory.getBean(MessageProducer.class);
    MessageConsumer messageConsumer =  SingletonServiceFactory.getBean(MessageConsumer.class);
    SagaLockManager sagaLockManager = SingletonServiceFactory.getBean(SagaLockManager.class);
    return new SagaCommandDispatcher("customerCommandDispatcher",
            customerCommandHandler.commandHandlerDefinitions(),
            channelMapping,
            messageConsumer,
            messageProducer,
            sagaLockManager);
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:14,代码来源:ComponentFactory.java

示例8: getOrderCommandDispatcher

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public static CommandDispatcher getOrderCommandDispatcher() {
    OrderCommandHandler orderCommandHandler = SingletonServiceFactory.getBean(OrderCommandHandler.class);
    ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
    MessageProducer messageProducer = SingletonServiceFactory.getBean(MessageProducer.class);
    MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
    SagaLockManager sagaLockManager = SingletonServiceFactory.getBean(SagaLockManager.class);
    return new SagaCommandDispatcher("orderCommandDispatcher",
            orderCommandHandler.commandHandlerDefinitions(),
            channelMapping,
            messageConsumer,
            messageProducer,
            sagaLockManager);

}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:15,代码来源:ComponentFactory.java

示例9: channelMapping

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public ChannelMapping channelMapping() {
    TramCommandsAndEventsIntegrationData data = SingletonServiceFactory.getBean(TramCommandsAndEventsIntegrationData.class);
    return DefaultChannelMapping.builder()
            .with("CustomerAggregate", data.getAggregateDestination())
            .with("customerService", data.getCommandChannel())
            .build();
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:8,代码来源:OrderCustomerServiceInitializer.java

示例10: pollingEventTableChangesToAggregateTopicTranslator

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public EventTableChangesToAggregateTopicTranslator<PublishedEvent> pollingEventTableChangesToAggregateTopicTranslator() {
    CdcKafkaPublisher<PublishedEvent> mySQLCdcKafkaPublisher = SingletonServiceFactory.getBean(CdcKafkaPublisher.class);
    CdcProcessor<PublishedEvent> mySQLCdcProcessor = SingletonServiceFactory.getBean(CdcProcessor.class);
    CuratorFramework curatorFramework = SingletonServiceFactory.getBean(CuratorFramework.class);

    return new EventTableChangesToAggregateTopicTranslator<>(mySQLCdcKafkaPublisher,
            mySQLCdcProcessor,
            curatorFramework,
            cdcConfig);
}
 
开发者ID:networknt,项目名称:light-eventuate-4j,代码行数:11,代码来源:PollingCdcServiceInitializer.java

示例11: pollingDao

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public PollingDao pollingDao() {
    DataSource ds = (DataSource) SingletonServiceFactory.getBean(DataSource.class);
    EventPollingDataProvider  pollingDataProvider= (EventPollingDataProvider) SingletonServiceFactory.getBean(EventPollingDataProvider.class);

    return new PollingDao (pollingDataProvider, ds,
            cdcConfig.getMaxEventsPerPolling(),
            cdcConfig.getMaxAttemptsForPolling(),
            cdcConfig.getPollingRetryIntervalInMilliseconds());
}
 
开发者ID:networknt,项目名称:light-eventuate-4j,代码行数:10,代码来源:PollingCdcServiceInitializer.java

示例12: testDirectRegistry

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
@Test
public void testDirectRegistry() {
    Registry registry = (Registry)SingletonServiceFactory.getBean(Registry.class);

    URL subscribeUrl = URLImpl.valueOf("light://localhost:8080/token");
    List<URL> urls = registry.discover(subscribeUrl);
    Assert.assertEquals(1, urls.size());

    subscribeUrl = URLImpl.valueOf("light://localhost:8080/code");
    urls = registry.discover(subscribeUrl);
    Assert.assertEquals(2, urls.size());
}
 
开发者ID:networknt,项目名称:light-4j,代码行数:13,代码来源:DirectRegistryTest.java

示例13: binlogOffsetKafkaStore

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public DatabaseBinlogOffsetKafkaStore binlogOffsetKafkaStore() {
    MySqlBinaryLogClient<PublishedEvent> mySqlBinaryLogClient = SingletonServiceFactory.getBean(MySqlBinaryLogClient.class);
    EventuateKafkaProducer eventuateKafkaProducer = SingletonServiceFactory.getBean(EventuateKafkaProducer.class);
    return new DatabaseBinlogOffsetKafkaStore(
            cdcConfig.getDbHistoryTopicName(),
            mySqlBinaryLogClient.getName(),
            eventuateKafkaProducer);
}
 
开发者ID:networknt,项目名称:light-eventuate-4j,代码行数:9,代码来源:MySqlCdcServiceInitializer.java

示例14: setUp

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    client = (MockConsulClient)SingletonServiceFactory.getBean(ConsulClient.class);
    registry = (ConsulRegistry)SingletonServiceFactory.getBean(Registry.class);

    serviceUrl = MockUtils.getMockUrl(8001);
    serviceUrl2 = MockUtils.getMockUrl(8002);
    serviceid = ConsulUtils.convertConsulSerivceId(serviceUrl);
    serviceid2 = ConsulUtils.convertConsulSerivceId(serviceUrl2);
    clientUrl = MockUtils.getMockUrl("127.0.0.1", 0);
    clientUrl2 = MockUtils.getMockUrl("127.0.0.2", 0);

    sleepTime = ConsulConstants.SWITCHER_CHECK_CIRCLE + 500;
}
 
开发者ID:networknt,项目名称:light-4j,代码行数:15,代码来源:ConsulRegistryTest.java

示例15: mySqlBinaryLogClient

import com.networknt.service.SingletonServiceFactory; //导入方法依赖的package包/类
public MySqlBinaryLogClient<PublishedEvent> mySqlBinaryLogClient() throws IOException, TimeoutException {
    IWriteRowsEventDataParser<PublishedEvent> eventDataParser = SingletonServiceFactory.getBean(IWriteRowsEventDataParser.class);
    SourceTableNameSupplier sourceTableNameSupplier = SingletonServiceFactory.getBean(SourceTableNameSupplier.class);
    return new MySqlBinaryLogClient<>(eventDataParser,
            cdcConfig.getDbUser(),
            cdcConfig.getDbPass(),
            cdcConfig.getDbHost(),
            cdcConfig.getDbPort(),
            cdcConfig.getBinlogClientId(),
            sourceTableNameSupplier.getSourceTableName(),
            cdcConfig.getMySqlBinLogClientName());
}
 
开发者ID:networknt,项目名称:light-eventuate-4j,代码行数:13,代码来源:MySqlCdcServiceInitializer.java


注:本文中的com.networknt.service.SingletonServiceFactory.getBean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。