I have a question regarding a Spring mechanism. Here is the Scenario:
I have an abstract Controller class that has some dependencies injected by the @Resource
Annotation. A Subclass contains the @RequestMapping
Annotation for handling the Request. Until now everything worked fine and all dependencies got injected.
Now I am trying to introduce Spring Security into our project but when I try to use @PreAuthorize
I get NullPointerException
in some @ModelAttribute
methods because the dependency injection fails now. I found out, that Spring makes a proxy class of my Controller but somehow does not inject all dependencies.
Maybe I am missing a configuration to tell Spring that the proxies have to use the dependencies of the target or that it should inject all dependencies into the proxy itself.
If somebody has an idea I would be happy to hear it.