开发者

How to assign java.util.logging.Level to a bean?

开发者 https://www.devze.com 2023-01-16 05:34 出处:网络
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><

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

精彩评论

暂无评论...
验证码 换一张
取 消