Spring Security不推荐使用@AuthenticationPrincipal [英] Spring Security deprecated @AuthenticationPrincipal
问题描述
您知道web.bind.annotation.AuthenticationPrincipal中的@AuthenticationPrincipal已弃用。建议使用core.annotation.AuthenticationPrincipal。
因此,我们已将import语句更改为core.annotation.AuthenticationPrincipal,现在出现以下错误:
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>()
此注释是否存在任何已知问题?
P.S我们正在使用参数化构造函数,但我们没有默认的构造函数,因此我知道这一点。
非常感谢。
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.
推荐答案
请确保您使用的是 org.springframework.security.web .method.annotation.AuthenticationPrincipalArgumentResolver
与 org.springframework.security.web.bind.support.AuthenticationPrincipalArgumententResolver
相对应。
Make sure you are using org.springframework.security.web.method.annotation.AuthenticationPrincipalArgumentResolver
as apposed to org.springframework.security.web.bind.support.AuthenticationPrincipalArgumentResolver
.
更新我创建了#3771 进行跟踪,以便在文档中更轻松地进行跟踪。
UPDATE I created #3771 to track making this easier to follow in the documentation.
这篇关于Spring Security不推荐使用@AuthenticationPrincipal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!