I have a servive interface called DataSource and more than 1 implementations like XMLDataSource, DataBaseDataSource etc.
I want to inject(Spring) appropriate implementation to my Struts2 Action based on some user interaction like if User clicks on XML then I need to use XML implementation. Spring has been used for DI framework.
@Autowired
private DataSource dataSource;
Please suggest what is best way to achieve this.