Skip to content

Commit

Permalink
chore: Autowired from fields to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph-Meyer committed Mar 17, 2021
1 parent bdd6f27 commit f622742
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,29 @@
@Service
public class StandardTaskService {

@Autowired
private ExternalRessourceService externalRessourceService;
private final ExternalRessourceService externalRessourceService;

@Autowired
private StandardTaskRepository standardTaskRepository;
private final StandardTaskRepository standardTaskRepository;

@Autowired
private QuestService questService;
private final QuestService questService;

@Autowired
private AdventureService adventureService;
private final AdventureService adventureService;

@Autowired
private WorldRepository worldRepository;
private final WorldRepository worldRepository;

@Autowired
private GratificationService gratificationService;
private final GratificationService gratificationService;

@Autowired
private NamedParameterJdbcTemplate template;
private final NamedParameterJdbcTemplate template;

public StandardTaskService(ExternalRessourceService externalRessourceService, StandardTaskRepository standardTaskRepository, QuestService questService, AdventureService adventureService, WorldRepository worldRepository, GratificationService gratificationService, NamedParameterJdbcTemplate template) {
this.externalRessourceService = externalRessourceService;
this.standardTaskRepository = standardTaskRepository;
this.questService = questService;
this.adventureService = adventureService;
this.worldRepository = worldRepository;
this.gratificationService = gratificationService;
this.template = template;
}

@Transactional
public void updateStandardTasks(final World world) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ public class TaskService {

private static final Logger LOGGER = LoggerFactory.getLogger(TaskService.class);

@Autowired
private TaskRepository taskRepository;
private final TaskRepository taskRepository;

@Autowired
private GratificationService gratificationService;
private final GratificationService gratificationService;

@Autowired
private QuestService questService;
private final QuestService questService;

@Autowired
private AdventureService adventureService;
private final AdventureService adventureService;

public TaskService(TaskRepository taskRepository, GratificationService gratificationService, QuestService questService, AdventureService adventureService) {
this.taskRepository = taskRepository;
this.gratificationService = gratificationService;
this.questService = questService;
this.adventureService = adventureService;
}

public List<Task> getFreeTasksForWorld(final World world) {
return taskRepository.findByWorldAndStatusAndQuestIsNull(world, SonarQuestTaskStatus.OPEN);
Expand Down

0 comments on commit f622742

Please sign in to comment.