實現類的註冊方法

oktokeep發表於2024-04-21

1.抽象類 @Qualifier 指定繫結的註冊類

    @Autowired
    @Qualifier("professionOrderSendEmailImpl")
    private SendBiDataService<ProfessionOrderEntity> sendBiDataService;

2.實現類

    @Autowired
   ProfessionOrderSendEmailImpl professionOrderSendEmailImpl;

3.都註冊成功啦,服務啟動列印Bean日誌檢視:

2024-03-27 12:06:12.322 [Thread-57][orderCoreApi,,,] INFO c.a.o.c.j.ProfessionOrderSendEmailTask#execute [line:51] - bean註冊(實現類方式) professionOrderSendEmailImpl=com.mytest.service.bi.ProfessionOrderSendEmailImpl@2bae8dff
2024-03-27 12:06:12.322 [Thread-57][orderCoreApi,,,] INFO c.a.o.c.j.ProfessionOrderSendEmailTask#execute [line:63] - bean註冊(繫結抽象類方式) sendBiDataService=com.mytest.service.bi.ProfessionOrderSendEmailImpl@2bae8dff

相關文章