static 메소드 내에서 Autowired 호출

  • xixixaxa
    (OOooOOoo)
  • xixixaxa's Avatar 이 글의 작성자
  • Offline
  • Newbie
  • Newbie
더보기
20 Jul 2022 08:44 #31920 작성자: xixixaxa
xixixaxa 님의 글: static 메소드 내에서 Autowired 호출
@Component
public class TestClass {
   private static AutowiredTypeComponent component;

   @Autowired
   private AutowiredTypeComponent autowiredComponent;

   @PostConstruct
   private void init() {
      component = this.autowiredComponent;
   }

   public static void testMethod() {
      component.callTestMethod();
   }
}
Time to create page: 0.053 seconds
Powered by Kunena Forum