4

From docs:

In the client class containing the method to be injected (the CommandManager in this case), the method that is to be 'injected' must have a signature of the following form:

<public|protected> [abstract] <return-type> theMethodName(no-arguments);

Does exists way to workaround this limitation?

3
  • What would you want Spring to do with the arguments of the method? Commented Apr 28, 2012 at 17:08
  • Try this. It's old, but contains useful pointers. Commented Apr 28, 2012 at 17:09
  • Check selected answer here stackoverflow.com/questions/5349362/… It worked for me. Commented Apr 12, 2016 at 18:26

1 Answer 1

3

Yes you can. Here is an example from the spring docs, http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html

 @Autowired
 public void prepare(MovieCatalog movieCatalog,
                   CustomerPreferenceDao customerPreferenceDao) {
   this.movieCatalog = movieCatalog;
   this.customerPreferenceDao = customerPreferenceDao;
 }
Sign up to request clarification or add additional context in comments.

3 Comments

Isn't OP asking about lookup methods? It's literally the method that is getting injected via proxying, not a method being injected its arguments.
mmm, the question was a little hard to understand. I thought I had the meaning of it...but reading your comment and re-reading the question, it sounds like you could be correct.
How do you call such a method? WIth 0 arguments and then some magic in an overloaded method will get the beans/arguments from the context?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.