Can you use @Autowired with static fields?

user124722 picture user124722 · Jun 19, 2009 · Viewed 149.4k times · Source

Is there some way to use @Autowired with static fields. If not, are there some other ways to do this?

Answer

skaffman picture skaffman · Jun 19, 2009

In short, no. You cannot autowire or manually wire static fields in Spring. You'll have to write your own logic to do this.