This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes @Autowired and  Static methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "@Autowired and  Static methods" Watch "@Autowired and  Static methods" New topic
Author

@Autowired and Static methods

Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 278
Hi

I am using @Autowired to inject some handler/translator instances(from Translator class) in my classes.
These translators do some exc conversion work once exception is thrown in methods.

Now i have some cases where methods are static methods and i need to handle these exceptions , i mean to translate.
what are my options.
Eg. This is rough code to show what i am trying to do .





I tried to create a static method in my translator class which i can directly call and use in my static methods.But then realized that is also used injected messageSource of Spring.
(Ie. @Autowired MessageSource -used to resolve messages).


Thanks
Lucky
 
jQuery in Action, 2nd edition
 
subject: @Autowired and Static methods
 
Similar Threads
What's wrong with this code????
GUI and events
How to find out where an Exception was thrown ?
K&B 1.5 p365 exceptions doubt
Swing Look and Feel not working