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

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

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

google shop client API returns 400 bad request error while adding an item -