Using Autowired bean inside Preauthorize expression in Spring

I have the following class for a resource in my Spring Application @RestController @RequestMapping(“/whatever”) public class SomeResource { @Autowired private CoolService coolService; @RequestMapping( path = “”, method = RequestMethod.GET) @PreAuthorize(“hasPerm(@coolService.resolve(#attribute))”) public void resource(@PathVariable(“attribute”) int attribute) { … } And I want to call the bean implementing CoolService that has been autowired by the Spring context,…

Details