The essence of the question: I have
@RestController @RequestMapping(value = "/features/{uin}", method = RequestMethod.GET) public class RestController { private Modul modul; @Resource(name = "modulService") private ModuleDAO modulService; ... } The {uin} parameter will be used in all methods to search for the entity. Is it possible to find this entity directly when creating a bean, for further use in the methods. For example, like this:
@RestController @RequestMapping(value = "/features/{uin}", method = RequestMethod.GET) public class RestController { private Modul modul; @Resource(name = "modulService") private ModuleDAO modulService; ... public RestController(@PathVariable("uin") String uin){ this.modul = modulService.findByUin(uin); ... } ... } But I don’t seem to be able to do this in the class constructor, they say that it’s impossible to inject a parameter.