How to assign java.util.logging.Level to a bean?
I created an application and want to config its logging.Level thorugh bean
<bean id="loggingLevel" class="java.util.logging.Level"> <constructor-arg> <value>INFO</value> </constructor-arg> </bean>
but it failed. Here is the error message: Unsatisfied dependency expressed through constructor argument with index 1 of type [int]: Ambiguous constructor argument types - did 开发者_JS百科you specify the correct bean references as constructor arguments?
So how to do it the right way?
Instances of java.util.logging.Level
are not intended to be instantiated this way, they should be obtained from static fields. In Spring you may use <util:constant>
:
<util:contstant id = "loggingLevel" static-field="java.util.logging.Level.INFO" />
精彩评论