Skip to content

Commit f4e45ea

Browse files
authored
Use constructor injection in Application class (#594)
1 parent 5fe6ec8 commit f4e45ea

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
1313

1414
- Configure Gradle JVM Test Suite Plugin. (#589)
1515
- Remove `ResponseEntity` wrapper in feign client. (#593)
16+
- Use constructor injection in `Application` class. (#594)
1617

1718
### Dependency Upgrades
1819

src/main/java/com/iexec/worker/Application.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.iexec.worker;
1818

19-
2019
import com.iexec.worker.chain.IexecHubService;
2120
import com.iexec.worker.feign.LoginService;
2221
import com.iexec.worker.replicate.ReplicateRecoveryService;
@@ -25,7 +24,6 @@
2524
import com.iexec.worker.worker.WorkerService;
2625
import lombok.extern.slf4j.Slf4j;
2726
import org.apache.commons.lang3.StringUtils;
28-
import org.springframework.beans.factory.annotation.Autowired;
2927
import org.springframework.boot.CommandLineRunner;
3028
import org.springframework.boot.SpringApplication;
3129
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -44,23 +42,26 @@
4442
@ConfigurationPropertiesScan
4543
public class Application implements CommandLineRunner {
4644

47-
@Autowired
48-
private String workerWalletAddress;
49-
50-
@Autowired
51-
private IexecHubService iexecHubService;
52-
53-
@Autowired
54-
private LoginService loginService;
55-
56-
@Autowired
57-
private WorkerService workerService;
58-
59-
@Autowired
60-
private ReplicateRecoveryService replicateRecoveryService;
61-
62-
@Autowired
63-
private ResultService resultService;
45+
private final String workerWalletAddress;
46+
private final IexecHubService iexecHubService;
47+
private final LoginService loginService;
48+
private final WorkerService workerService;
49+
private final ReplicateRecoveryService replicateRecoveryService;
50+
private final ResultService resultService;
51+
52+
public Application(String workerWalletAddress,
53+
IexecHubService iexecHubService,
54+
LoginService loginService,
55+
WorkerService workerService,
56+
ReplicateRecoveryService replicateRecoveryService,
57+
ResultService resultService) {
58+
this.workerWalletAddress = workerWalletAddress;
59+
this.iexecHubService = iexecHubService;
60+
this.loginService = loginService;
61+
this.workerService = workerService;
62+
this.replicateRecoveryService = replicateRecoveryService;
63+
this.resultService = resultService;
64+
}
6465

6566
public static void main(String[] args) {
6667
SpringApplication.run(Application.class, args);

0 commit comments

Comments
 (0)