In general, public static not the final field of evil . Spring does not allow such fields to be entered for any reason.
Your workaround is indeed, you don't even need getter / setter, the private field is enough. On the other hand, try the following:
@Value("${my.name}") public void setPrivateName(String privateName) { Sample.name = privateName; }
(works with @Autowired / @Resource ). But give you some constructive advice: create a second class with a private and getter field instead of a public static field.
Tomasz Nurkiewicz Aug 31 '11 at 7:18 2011-08-31 07:18
source share