I was looking through similar questions, but did not find anything that helped:
In my spring security configuration class I configure my AuthenticationManager like this (to use a UserDetailsService implementation). I have read, that this should configure a global authentication manager to use.
@EnableWebMvc
@EnableWebSecurity
@ComponentScan
@Configuration
public class WebMvcConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {
    
    // Other things...
    @Autowired
    @Qualifier("authenticationManager")
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
    }
}
My question is: How to use it in a custom controller? If I try it like this ...
@Controller
@RequestMapping(value = "/perform_login", method = RequestMethod.POST)
public class LoginController {
    
    @Resource
    private AuthenticationManager authenticationManager;
    @GetMapping
    public ModelAndView login(
        // login logic using the authenticationManager
    }
    
}
... then it says, that no bean of type AuthenticationManagerBuilder is available. So please help me out: Where is my misunderstanding? How can I actually use the AuthenticationManager?
