Announcement Announcement Module
No announcement yet.
Static field initialization before all other beans Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Static field initialization before all other beans

    Hi all!

    I need set static field of class before any other bean in Spring Context will have initialized. I need it because I create the instances of this class with "new" in beans (that in Spring Context) and I must be sure that the static field is already initialized whenever I get it in any bean.

    Thank you.

  • #2
    Spring can't inject your static field as the @Autowired is not supported for static fields. You'll have to make your field as non-static and may get around it by using @Configurable annotation. But will that solve your problem depends upon your specific problem.