Is it mandatory to define the loaduserbyusername method with throws usernamenotfound exception in spring security ???
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException
Well i get a findbugs error saying redundant throws of usernamenotfoundexception .. how to avoid this ?
It’s just that you do not have to declare the
throws UsernameNotFoundExceptionin your method signature, becauseUsernameNotFoundExceptionis a runtime exception.See this for a detailed explanation.