参考链接:https://www.cnblogs.com/chenfeng1122/p/6270217.html
//用@PostConstruct注解
@Component
public class Test {
private static UserService userService;
@Autowired
private UserService userService2;
@PostConstruct
public void beforeInit() {
userService = userService2;
}
public static void test() {
userService.test();
}
}
来源:CSDN
作者:zongmaomx
链接:https://blog.csdn.net/zongmaomx/article/details/104717708