Spring Security deprecated @AuthenticationPrincipal

左心房为你撑大大i 提交于 2019-12-11 01:29:53

问题


As you know @AuthenticationPrincipal in web.bind.annotation.AuthenticationPrincipal is depreacted . It is recommended to use core.annotation.AuthenticationPrincipal. So we have changed import statements as core.annotation.AuthenticationPrincipal and now we are getting below error :

org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.xxx.authentication.OurUserDetailsImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.xxx.xxx.authentication.OurUserDetailsImpl.<init>()

Are there any known problem related with this annotation ? P.S we are using parameterized constructor and we dont have a default constructor so I am aware of this. Many thanks.


回答1:


Make sure you are using org.springframework.security.web.method.annotation.AuthenticationPrincipalArgum‌​entResolver as apposed to org.springframework.security.web.bind.support.AuthenticationPrincipalArgum‌​entResolver.

UPDATE I created #3771 to track making this easier to follow in the documentation.



来源:https://stackoverflow.com/questions/36219009/spring-security-deprecated-authenticationprincipal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!