I have a Singleton class ReadingStratgeyImp that extends from an Interface ReadingStrategy. In readingStrategyImp-getInstance() method will return the instance of ReadingStrategyImp.
Here is my query:
I want to inject the dependency of ReadingStrategyImp in a few of the other classes of the project.
I am achieving this by below code
ReadingStrategy readingStrategy;
@Autowired
public void setReadingStrategy(ReadingStrategyImp readingStrategy) {
this.readingStrategy = ReadingStrategyImp.getInstance();
}
I want to know how one will inject the dependency.