public class DbConfiguration extends Object
Constructor and Description |
---|
DbConfiguration() |
Modifier and Type | Method and Description |
---|---|
static void |
addConnectionWrapper(ConnectionSpecWrapper connectionWrapper,
boolean override) |
static void |
clearConnectionWrappers() |
protected static void |
clearConnectionWrappers(String env) |
static List<ConnectionSpecWrapper> |
getConnectionSpecWrappers()
Provides a list of all connection wrappers corresponding to a current environment.
|
static List<ConnectionSpecWrapper> |
getConnectionSpecWrappers(String env)
Provides a list of all connection wrappers corresponding to a given environment.
|
List<ConnectionSpecWrapper> |
getTestConnectionWrappers() |
void |
loadConfiguration(String file)
Configures multiple database connections from a single property file.
|
static void |
resetConnectionWrappers() |
public static void addConnectionWrapper(ConnectionSpecWrapper connectionWrapper, boolean override)
public static List<ConnectionSpecWrapper> getConnectionSpecWrappers()
public static List<ConnectionSpecWrapper> getConnectionSpecWrappers(String env)
env
- name of environment, such as "development", "production", etc.public static void clearConnectionWrappers()
public static void resetConnectionWrappers()
protected static void clearConnectionWrappers(String env)
public void loadConfiguration(String file)
development.driver=com.mysql.jdbc.Driver development.username=john development.password=pwd development.url=jdbc:mysql://localhost/proj_dev test.driver=com.mysql.jdbc.Driver test.username=mary test.password=pwd1 test.url=jdbc:mysql://localhost/test production.jndi=java:comp/env/jdbc/prod # this one is to run migrations in production remotely production.remote.driver=com.mysql.jdbc.Driver production.remote.username=root production.remote.password=xxx production.remote.url=jdbc:mysql://127.0.0.1:3307/poj1_productionRules and limitations of using a file-based configuration:
file
- path to a file. Can be located on classpath, or on a file system. First searched on classpath,
then on file system.public List<ConnectionSpecWrapper> getTestConnectionWrappers()
Copyright © 2019 JavaLite. All rights reserved.