applied joris's no derby log patch
This commit is contained in:
parent
72c330fffb
commit
0cc3542aed
|
|
@ -17,7 +17,7 @@ Changes in version 3.0.0.RC1 (2009-06-10)
|
|||
* ReloadableResourceBundleMessageSource correctly calculates filenames for all locales now
|
||||
* @Import detects and accepts existing configuration class of the desired type
|
||||
* @Transactional supports qualifier value for choosing between multiple transaction managers
|
||||
* added spring-jdbc config schema with initial embedded-database tag (supporting HSQL and H2)
|
||||
* added spring-jdbc config schema with embedded-database tag (supporting HSQL, H2, and Derby)
|
||||
* Velocity/FreeMarker/TilesViewResolver only return a view if the target resource exists now
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package org.springframework.jdbc.datasource.embedded;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
|
@ -55,6 +56,9 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
|
|||
*/
|
||||
public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException {
|
||||
if (INSTANCE == null) {
|
||||
// disable log file
|
||||
System.setProperty("derby.stream.error.method",
|
||||
DerbyEmbeddedDatabaseConfigurer.class.getName() + ".getNoopOutputStream");
|
||||
ClassUtils.forName("org.apache.derby.jdbc.EmbeddedDriver", DerbyEmbeddedDatabaseConfigurer.class
|
||||
.getClassLoader());
|
||||
INSTANCE = new DerbyEmbeddedDatabaseConfigurer();
|
||||
|
|
@ -102,4 +106,17 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link OutputStream} that ignores all data given to it.
|
||||
* Used by {@link #getInstance()} to prevent writing to Derby.log file.
|
||||
*/
|
||||
static OutputStream getNoopOutputStream() {
|
||||
return new OutputStream() {
|
||||
public void write(int b) throws IOException {
|
||||
// ignore the input
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue