Mesut Dogan
Mesut Dogan

Reputation: 592

Spring Security deprecated @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>()

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.

Upvotes: 2

Views: 2878

Answers (1)

Rob Winch
Rob Winch

Reputation: 21730

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.

Upvotes: 5

Related Questions