I tried calling superclass public setter method from the subclass constructor and the code just works fine. Is it ok to do so or is it considered a bad practice? What can be the problem if its bad?
Edit: I have an AuthFilter
public class AuthFilter extends UsernamePasswordAuthenticationFilter {
public AuthFilter(AuthenticationManager authenticationManager) {
setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/user/login", "POST"));
this.authenticationManager = authenticationManager;
}
}
The UsernamePasswordAuthenticationFilter has the constructor
public UsernamePasswordAuthenticationFilter() extends AbstractAuthenticationProcessingFilter {
super(new AntPathRequestMatcher("/login", "POST"));
}
So I am using the method setRequiresAuthenticationRequestMatcher(RequestMatcher requestMatcher)
present in AbstractAuthenticationProcessingFilter
to change the login path. This works, but is this the right way to do this?