If one of the controller methods is annotated with springsecurity Pre/PostAuthorize I get a null pointer exception when booting the application:
...
Caused by: java.lang.NullPointerException
at org.springframework.data.rest.webmvc.ResourceProcessorHandlerMethodReturnValueHandler.<init>(ResourceProcessorHandlerMethodReturnValueHandler.java:89)
at org.springframework.data.rest.webmvc.ResourceProcessorInvokingHandlerAdapter.afterPropertiesSet(ResourceProcessorInvokingHandlerAdapter.java:75)
at org.springframework.data.rest.webmvc.RepositoryRestHandlerAdapter.afterPropertiesSet(RepositoryRestHandlerAdapter.java:60)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
...
I think the issue lies in the processor being Proxy$... instead of the ControllerClass.
Moving the method to another class, for instance the DAO fixes the issue as an workaround.
Not sure if this is a bug, a design choice or if i'm missing something.
Manuel Sousa opened DATAREST-702 and commented
I have a custom controller which implements ResourceProcessor<RepositoryLinksResource> in order to populate the root response as in: http://stackoverflow.com/questions/25783487/custom-response-for-root-request-int-the-spring-rest-hateoas-with-both-repositor/26118405#26118405
If one of the controller methods is annotated with springsecurity Pre/PostAuthorize I get a null pointer exception when booting the application:
...
Caused by: java.lang.NullPointerException
at org.springframework.data.rest.webmvc.ResourceProcessorHandlerMethodReturnValueHandler.<init>(ResourceProcessorHandlerMethodReturnValueHandler.java:89)
at org.springframework.data.rest.webmvc.ResourceProcessorInvokingHandlerAdapter.afterPropertiesSet(ResourceProcessorInvokingHandlerAdapter.java:75)
at org.springframework.data.rest.webmvc.RepositoryRestHandlerAdapter.afterPropertiesSet(RepositoryRestHandlerAdapter.java:60)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
...
I think the issue lies in the processor being Proxy$... instead of the ControllerClass.
Moving the method to another class, for instance the DAO fixes the issue as an workaround.
Not sure if this is a bug, a design choice or if i'm missing something.
Removing the
@PreAuthorize
or moving it to the dao is enough for it to work as expectedAffects: 2.4 GA (Gosling)
Referenced from: commits e08dff8
The text was updated successfully, but these errors were encountered: