本文整理汇总了Java中org.jooq.ConnectionProvider类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionProvider类的具体用法?Java ConnectionProvider怎么用?Java ConnectionProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionProvider类属于org.jooq包,在下文中一共展示了ConnectionProvider类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initInternal
import org.jooq.ConnectionProvider; //导入依赖的package包/类
private static void initInternal(final Vertx vertx,
final String name) {
vertxRef = vertx;
Fn.pool(CONFIGS, name,
() -> Infix.init(Plugins.Infix.JOOQ,
(config) -> {
// Initialized client
final Configuration configuration = new DefaultConfiguration();
configuration.set(SQLDialect.MYSQL_8_0);
final ConnectionProvider provider =
new DefaultConnectionProvider(HikariCpPool.getConnection(
config.getJsonObject("provider")
));
// Initialized default configuration
configuration.set(provider);
return configuration;
}, JooqInfix.class));
}
示例2: DslContextConfiguration
import org.jooq.ConnectionProvider; //导入依赖的package包/类
public DslContextConfiguration(JooqProperties properties,
ConnectionProvider connectionProvider,
ObjectProvider<TransactionProvider> transactionProviderProvider,
ObjectProvider<RecordMapperProvider> recordMapperProviderProvider,
ObjectProvider<Settings> settingsProvider,
ObjectProvider<RecordListenerProvider[]> recordListenerProvidersProvider,
ExecuteListenerProvider[] executeListenerProviders,
ObjectProvider<VisitListenerProvider[]> visitListenerProvidersProvider) {
this.properties = properties;
this.connectionProvider = connectionProvider;
this.transactionProvider = transactionProviderProvider.getIfAvailable();
this.recordMapperProvider = recordMapperProviderProvider.getIfAvailable();
this.settings = settingsProvider.getIfAvailable();
this.recordListenerProviders = recordListenerProvidersProvider
.getIfAvailable();
this.executeListenerProviders = executeListenerProviders;
this.visitListenerProviders = visitListenerProvidersProvider.getIfAvailable();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:JooqAutoConfiguration.java
示例3: configure
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Override
protected void configure() {
bind(credentials).to(TwitterCredentials[].class);
bind(alignments).to(DataSource.class);
bind(sparqlLocation).named("SPARQLEndpoint").to(String.class);
bind(ngramsEndpoint).named("NgramsEndpoint").to(String.class);
bind(wikimachineEndpoint).named("WikimachineEndpoint").to(String.class);
bind(lsaFilename).named("lsaFilename").to(String.class);
bind(scaler).to(Scaler.class);
bind(modelEndpoint).to(ModelEndpoint.class);
bindFactory(TwitterFactory.class).to(Twitter[].class);
bindFactory(ConnectionFactory.class).to(ConnectionProvider.class).in(Singleton.class);
bind(AlignmentsService.class).to(AlignmentsService.class);
bind(TwitterService.class).to(TwitterService.class);
bind(KBAccessService.class).to(KBAccessService.class).in(Singleton.class);
bind(WikimachineService.class).to(WikimachineService.class).in(Singleton.class);
bind(AnnotationService.class).to(AnnotationService.class).in(Singleton.class);
bind(MLService.class).to(MLService.class).in(Singleton.class);
bind(ResourcesService.class).to(ResourcesService.class).in(Singleton.class);
bind(NGramsService.class).to(NGramsService.class).in(Singleton.class);
bind(OnlineAlignmentsService.class).to(OnlineAlignmentsService.class).in(Singleton.class);
}
示例4: configure
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Override
protected void configure() {
// bind default Configuration to DSLContext
bindFactory(new DSLContextFactory(configurationMap.values().stream().findFirst().orElse(null)))
.to(DSLContext.class)
.in(RequestScoped.class);
// bind multiple instances of Configuration and ConnectionProvider for Named DSLContext(s)
for (final Configuration configuration : configurationMap.values()) {
bind(configuration).to(Configuration.class);
bind(configuration.connectionProvider())
.to(ConnectionProvider.class);
}
// bind a ValueFactoryProvider for Named DSLContext(s)
bind(new DSLContextValueFactoryProvider(configurationMap))
.to(ValueFactoryProvider.class);
}
示例5: configure
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
HikariDataSource ds = (HikariDataSource) env.get(dskey)
.orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
Configuration jooqconf = new DefaultConfiguration();
ConnectionProvider dscp = new DataSourceConnectionProvider(ds);
jooqconf.set(JDBCUtils.dialect(ds.getDataSourceProperties().getProperty("url")));
jooqconf.set(dscp);
jooqconf.set(new DefaultTransactionProvider(dscp));
if (callback != null) {
callback.accept(jooqconf, conf);
}
ServiceKey serviceKey = env.serviceKey();
serviceKey.generate(Configuration.class, name, k -> binder.bind(k).toInstance(jooqconf));
Provider<DSLContext> dsl = () -> DSL.using(jooqconf);
serviceKey.generate(DSLContext.class, name, k -> binder.bind(k).toProvider(dsl));
}
示例6: getDSLContext
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Bean
public DSLContext getDSLContext() {
HikariDataSource hikariDataSource = new HikariDataSource();
hikariDataSource.setJdbcUrl(environment.getProperty("spring.datasource.url"));
hikariDataSource.setUsername(environment.getProperty("spring.datasource.username"));
hikariDataSource.setPassword(environment.getProperty("spring.datasource.password"));
ConnectionProvider connectionProvider = new DataSourceConnectionProvider(hikariDataSource);
org.jooq.Configuration configuration = new DefaultConfiguration().set(connectionProvider).set(SQLDialect.MYSQL);
return DSL.using(configuration);
}
示例7: build
import org.jooq.ConnectionProvider; //导入依赖的package包/类
public Configuration build(Environment environment, PooledDataSourceFactory factory, String name) throws ClassNotFoundException {
final Settings settings = buildSettings();
final ManagedDataSource dataSource = factory.build(environment.metrics(), name);
final SQLDialect dialect = determineDialect(factory, dataSource);
final ConnectionProvider connectionProvider = new DataSourceConnectionProvider(dataSource);
final Configuration config = new DefaultConfiguration()
.set(settings)
.set(dialect)
.set(connectionProvider);
environment.lifecycle().manage(dataSource);
return config;
}
示例8: produceConnectionProvider
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Produces
@ApplicationScoped
public ConnectionProvider produceConnectionProvider() {
JooqConnectionProvider.log.info("Producing a connection provider");
return new DataSourceConnectionProvider(ds);
}
示例9: produceConnectionProvider
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Produces
@ApplicationScoped
public ConnectionProvider produceConnectionProvider() {
log.info("Producing a connection provider");
return new DataSourceConnectionProvider(ds);
}
示例10: provide
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Override
public ConnectionProvider provide() {
return provider;
}
示例11: dispose
import org.jooq.ConnectionProvider; //导入依赖的package包/类
@Override
public void dispose(ConnectionProvider instance) {
}
示例12: getConnectionProvider
import org.jooq.ConnectionProvider; //导入依赖的package包/类
public ConnectionProvider getConnectionProvider() {
return connectionProvider;
}
示例13: setConnectionProvider
import org.jooq.ConnectionProvider; //导入依赖的package包/类
public void setConnectionProvider(ConnectionProvider connectionProvider) {
this.connectionProvider = connectionProvider;
}