为什么 activejdbc 类 ConnectionSpecWrapper 在最近的版本中消失了?
在 3.0(以及 2.3.2-j8)activejdbc jar 中,我们有:
org/javalite/activejdbc/connection_config/ConnectionJndiConfig.class
org/javalite/activejdbc/connection_config/ConnectionConfig.class
org/javalite/activejdbc/connection_config/ConnectionJdbcConfig.class
org/javalite/activejdbc/connection_config/ConnectionDataSourceConfig.class
org/javalite/activejdbc/connection_config/DBConfiguration.class
在 2.3 jar 中,我们有
org/javalite/activejdbc/connection_config/ConnectionSpecWrapper.class
org/javalite/activejdbc/connection_config/DbConfiguration.class
org/javalite/activejdbc/connection_config/ConnectionJdbcSpec.class
org/javalite/activejdbc/connection_config/ConnectionSpec.class
org/javalite/activejdbc/connection_config/ConnectionDataSourceSpec.class
org/javalite/activejdbc/connection_config/ConnectionJndiSpec.class
我在过滤器中像这样使用它:
@Override
public void before() {
if(Configuration.isTesting())
return;
List<ConnectionSpecWrapper> connectionWrappers = getConnectionWrappers();
if (connectionWrappers.isEmpty()) {
throw new InitException("There are no connection specs in '" + Configuration.getEnv() + "' environment");
}
for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) {
DB db = new DB(connectionWrapper.getDbName());
db.open(connectionWrapper.getConnectionSpec());
log.debug("Opened connection: " + connectionWrapper.getDbName() + " envname " + connectionWrapper.getEnvironment());
if(manageTransaction){
db.openTransaction();
}
}
}
@Override
public void after() {
if(Configuration.isTesting())
return;
List<ConnectionSpecWrapper> connectionWrappers = getConnectionWrappers();
if (connectionWrappers != null && !connectionWrappers.isEmpty()) {
for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) {
DB db = new DB(connectionWrapper.getDbName());
if(manageTransaction){
db.commitTransaction();
}
db.close();
log.debug("Closed connection: " + connectionWrapper.getDbName() + " envname " + connectionWrapper.getEnvironment());
}
}
}
我正在考虑升级 Gazzetta dello Sport 的梦幻足球网站,该网站已经运行了 8 年并且运行良好。它位于 Java 7/Activeweb 1.10/Activejdbc 1.4.9