在Spring中注入静态常量的值 [英] Injecting values for static constants in Spring
本文介绍了在Spring中注入静态常量的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的一个类中有一个 public static String
成员,我需要在 applicationContext.xml中设置此值
!也就是说,我们可以为这个静态属性注入一个值吗?
In one of my classes there is a public static String
member and I need set this value in the applicationContext.xml
! That is, is it possible for us to inject a value for this static property?
推荐答案
是的,这个链接有一个例子 http://planproof-fool.blogspot.com/2010 /03/spring-setting-static-fields.html
yes there is an example on this link http://planproof-fool.blogspot.com/2010/03/spring-setting-static-fields.html
这篇关于在Spring中注入静态常量的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文