我创建了一个应用程序,并希望配置其logging.Level thorugh bean
<bean id="loggingLevel" class="java.util.logging.Level"> <constructor-arg> <value>INFO</value> </constructor-arg> </bean>
但失败了。这是错误消息: 通过带有[int]类型的索引1的构造函数参数表示不满意的依赖:不明确的构造函数参数类型 - 您是否将正确的bean引用指定为构造函数参数?
那么如何以正确的方式做到这一点?
答案 0 :(得分:0)
java.util.logging.Level
的实例不打算以这种方式实例化,它们应该从静态字段中获取。在Spring中,您可以使用<util:constant>
:
<util:contstant id = "loggingLevel" static-field="java.util.logging.Level.INFO" />