tags:

views:

12

answers:

1

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 you specify the correct bean references as constructor arguments?

So how to do it the right way?

A: 

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" />
axtavt