本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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;
}
示例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());
}