我有这样的枚举:
public enum SomeEnum {
ONE (new MyClass()),
TWO (new MyClass());
private final MyClass instance;
private SomeEnum(MyClass instance) {
this.instance = instance;
}
}
Run Code Online (Sandbox Code Playgroud)
如何从Spring上下文中将MyClass实例传递给枚举构造函数?它甚至可能吗?
我需要它,因为我在创建它时将一些参数从config(.properties文件)传递到MyClass实例.现在我在使用bean的xml文件中执行它,也许还有另一种方法?
我的log4j配置有问题。
在Maven将我的应用程序打包到war文件中之前,它将运行测试。并加载并使用log4j配置-创建日志文件,并在其中和控制台中写入消息。
控制台中有log4j调试输出:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@422ede.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@422ede class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@422ede.
log4j: Using URL [file:/C:/dev/workspace/paymentsystemsstub/target/classes/log4j.properties] for automatic log4j configuration.
log4j: Reading configuration from URL file:/C:/dev/workspace/paymentsystemsstub/target/classes/log4j.properties
log4j: Parsing for [root] with value=[WARN, file, stdout].
log4j: Level token is [WARN].
log4j: Category root set to WARN
log4j: Parsing appender named "file".
log4j: Parsing layout options for …Run Code Online (Sandbox Code Playgroud) 我试图了解org.apache.commons.dbcp.BasicDataSource中的maxWait是什么.文档说它是:
池将在抛出异常之前返回的连接等待(当没有可用连接时)的最大毫秒数,或<= 0无限期等待.
但我还是无法理解.我试着去谷歌,但我的怀疑只是增加了.
我看到两种解释这个定义的方法:
请帮助我理解哪个陈述是真的.或者可能还有其他一些定义:)