下面这三种方式都能实现功能
JwtLoginRequestSuccessHandler 与 JwtUserService 都已在 config 中注册为 Bean
请教各位大佬这三种方式的优缺点以及大佬们经常使用哪种方式
谢谢
[方式一]
public class JwtLoginRequestSuccessHandler implements AuthenticationSuccessHandler {
...
private JwtUserService jwtUserService;
public JwtLoginRequestSuccessHandler(JwtUserService jwtUserService) {
this.jwtUserService = jwtUserService;
}
...
}
[方式二]
public class JwtLoginRequestSuccessHandler implements AuthenticationSuccessHandler {
...
@
Autowired private JwtUserService jwtUserService;
...
}
[方式三]
public class JwtLoginRequestSuccessHandler implements AuthenticationSuccessHandler {
...
private JwtUserService jwtUserService;
@
Autowired public JwtLoginRequestSuccessHandler(JwtUserService jwtUserService) {
this.jwtUserService = jwtUserService;
}
...
}