-
Sep 21st, 2012, 12:50 PM
#1
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.
-
Sep 27th, 2012, 05:59 AM
#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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules