Results 1 to 2 of 2

Thread: Static field initialization before all other beans

  1. #1
    Join Date
    Sep 2011
    Posts
    4

    Default 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. #2
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •