Is there a way to bind an injected object to a specific instance using Spring DI similar to Google Guice’s
bind(MyClass.class).toInstance(myclassobject);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the constructor or member variable is annotated with
@Autowired, Spring will try to find a bean that matches the type of the Object. You can get similar functionality to the annotation using@Qualifier, for example:would become in Spring:
See http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-autowired-annotation for more.