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


Java EbeanServerFactory类代码示例

本文整理汇总了Java中io.ebean.EbeanServerFactory的典型用法代码示例。如果您正苦于以下问题:Java EbeanServerFactory类的具体用法?Java EbeanServerFactory怎么用?Java EbeanServerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getObject

import io.ebean.EbeanServerFactory; //导入依赖的package包/类
@Override
  public EbeanServer getObject() throws Exception {

    ServerConfig config = new ServerConfig();
    config.setName("db");
    config.setCurrentUserProvider(currentUser);

//    // set the spring's datasource and transaction manager.
//    config.setDataSource(dataSource);
//    config.setExternalTransactionManager(new SpringAwareJdbcTransactionManager());

    config.loadFromProperties();
    
    // set as default and register so that Model can be
    // used if desired for save() and update() etc
    config.setDefaultServer(true);
    config.setRegister(true);

    return EbeanServerFactory.create(config);
  }
 
开发者ID:ebean-orm-examples,项目名称:example-springboot,代码行数:21,代码来源:EbeanFactoryBean.java

示例2: get

import io.ebean.EbeanServerFactory; //导入依赖的package包/类
@Override
public EbeanServer get() {
    String datasourceUrl = mConfiguration.getString(SERVER_CONFIG_PREFIX + "url");
    String datasourceUsername = mConfiguration.getString(SERVER_CONFIG_PREFIX + "username");
    String datasourcePassword = mConfiguration.getString(SERVER_CONFIG_PREFIX + "password");
    String datasourceDriver = mConfiguration.getString(SERVER_CONFIG_PREFIX + "driver");
    String databaseName = mConfiguration.getString(SERVER_CONFIG_PREFIX + "name");
    String platformName = mConfiguration.getString(SERVER_CONFIG_PREFIX + "platformName");

    DataSourceConfig dataSourceConfig = new DataSourceConfig();
    dataSourceConfig.setUrl(datasourceUrl);
    dataSourceConfig.setDriver(datasourceDriver);
    dataSourceConfig.setUsername(datasourceUsername);
    dataSourceConfig.setPassword(datasourcePassword);

    dataSourceConfig.setHeartbeatFreqSecs(60);
    dataSourceConfig.setHeartbeatTimeoutSeconds(30);
    dataSourceConfig.setMinConnections(3);
    dataSourceConfig.setMaxConnections(30);
    dataSourceConfig.setLeakTimeMinutes(1);
    dataSourceConfig.setMaxInactiveTimeSecs(30);
    dataSourceConfig.setWaitTimeoutMillis(1000 * 60);
    dataSourceConfig.setTrimPoolFreqSecs(60);
    dataSourceConfig.setCaptureStackTrace(true);

    ArrayList<Class<?>> models = new ArrayList<>();
    models.add(Credentials.class);
    models.add(Message.class);
    models.add(PayloadElement.class);
    models.add(Recipient.class);
    models.add(PlatformFailure.class);
    models.add(Task.class);

    ServerConfig serverConfig = new ServerConfig();
    serverConfig.setDataSourceConfig(dataSourceConfig);
    serverConfig.setName(databaseName);
    serverConfig.setDatabasePlatformName(platformName);
    serverConfig.setRegister(true);
    serverConfig.setDefaultServer(true);
    serverConfig.setUpdatesDeleteMissingChildren(false);
    serverConfig.setClasses(models);
    serverConfig.setDdlGenerate(false);
    serverConfig.setUpdateChangesOnly(false);

    return EbeanServerFactory.create(serverConfig);
}
 
开发者ID:splendidbits,项目名称:play-pushservices,代码行数:47,代码来源:PushServicesEbeanServerProvider.java

示例3: defaultEbeanServer

import io.ebean.EbeanServerFactory; //导入依赖的package包/类
@Bean
@Primary
public EbeanServer defaultEbeanServer(ServerConfig defaultEbeanServerConfig) {
  return EbeanServerFactory.create(defaultEbeanServerConfig);
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:6,代码来源:SampleConfig.java

示例4: create

import io.ebean.EbeanServerFactory; //导入依赖的package包/类
public EbeanServer create() {
  return EbeanServerFactory.create(config);
}
 
开发者ID:ebean-orm-examples,项目名称:example-multi-tenancy-partition,代码行数:4,代码来源:BootstrapEbean.java

示例5: start

import io.ebean.EbeanServerFactory; //导入依赖的package包/类
/**
 * Initialise the Ebean servers.
 */
public void start() {
    config.serverConfigs().forEach((key, serverConfig) -> servers.put(key, EbeanServerFactory.create(serverConfig)));
}
 
开发者ID:playframework,项目名称:play-ebean,代码行数:7,代码来源:EbeanDynamicEvolutions.java


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