Runnable注記注入


コンストラクション関数の形式で注釈を入力すればよい
public class RunnableTask implements Runnable {


    private int projectId;

    private TransactionService transactionService; //         


    RunnableTask() {
    }

    //      Controller 
    // @Autowired
    // private TransactionService transactionService;
    //            Runnable  
    public RunnableTask(int projectId, TransactionService transactionService) {
        this.projectId = projectId;
        this.transactionService = transactionService;
    }

    @Override
    public void run() {
            ...
    }
}