java - How can I inject from a field? -


i use spring , can inject method.

@bean ilogger loggerservice() {     return new ilogger() {         public void log() {             system.out.println("logger!");                       }                    }; } 

but i'd inject field:

@ ??? annotation ilogger logger = new ilogger(){     public void log() {         system.out.println("logger!");     }    }; 

can possible? annotation should use?

this not possible. in spring javaconfig beans in @configuration must produced methods of class


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -