java静态方法中使用 spring的初始化的变量
文章目录
1.伪代码,大概其是这个意思。
@Component
public class StaticDemo {
@Resource
TestService testService;
private static StaticDemo staticDemo;
@PostConstruct
public void init() {
staticDemo = this;
}
private static void testMethod() {
staticDemo.testService.xxx();
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册⭐️ Admin快速开发: https://show.cool-admin.com/
赞 0⭐️ 官方文档: https://cool-js.com
赞 0⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld
赞 0