我在创建一个新bean时遇到了一个小问题。基本上按照请求,我得到一些参数,需要传递给一个bean。下面我为每个请求实例化ControllerService。相反,我希望它是一个scope = protype的bean。这样我就可以为每个请求获得一个新对象。 但是,那么我如何设置我通过构造函数在bean中发送的2个属性(kpiName,kpiInput)?Bean中的构造函数
@Autowired
@Qualifier("serviceManager")
Cleanser serviceManager;
@RequestMapping(method = RequestMethod.POST)
public @ResponseBody
String getKPIResult(@RequestParam("kpiName") String kpiName,
@RequestParam("kpiInput") String kpiInput) {
return serviceManager.checkAndExecute(new ControllerService(kpiName, kpiInput));
}