You can search programmatically:
private @Autowired BeanFactory beanFactory;
@RequestMapping("/blabla")
public void perform (@RequestParam String strategyName) {
Strategy strategy = beanFactory.getBean(strategyName, Strategy.class);
strategy.doStuff();
}
You can do it in a more attractive way using a custom one WebArgumentResolver, but this is a lot more of a problem than it costs.
source
share