I want use environment property in MyLoginSuccessHandler
class that is used in SpringSecurity.
You know, MyLoginSuccessHandler
implements AuthenticationSuccessHandler
.
But, most examples show usage of @autowired
like below.
@Autowired
private Environment env;
But autowired env variable is null. Because this is login success handler not controller.
I wish to know initialize environment object without @Autowired
annotation. I want to use env object to access a property in application.yml
.
If you are alright, please describe how @Autowired
works. Sometimes I face such this situation, but I do not know how it works.
Thanks.