本文整理汇总了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);
}
示例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);
}
示例3: defaultEbeanServer
import io.ebean.EbeanServerFactory; //导入依赖的package包/类
@Bean
@Primary
public EbeanServer defaultEbeanServer(ServerConfig defaultEbeanServerConfig) {
return EbeanServerFactory.create(defaultEbeanServerConfig);
}
示例4: create
import io.ebean.EbeanServerFactory; //导入依赖的package包/类
public EbeanServer create() {
return EbeanServerFactory.create(config);
}
示例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)));
}