Skip to content

Commit

Permalink
lit'l refac
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskirchenj committed Apr 22, 2024
1 parent 931e20a commit 9d2a99f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
java
id("org.springframework.boot") version "3.2.0"
id("org.springframework.boot") version "3.2.5"
id("io.spring.dependency-management") version "1.1.4"
id("org.sonarqube") version "4.2.1.3168"
//id("org.sonarqube") version "4.3.1.3277"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import de.cofinpro.splitter.controller.command.UnknownCommand;
import de.cofinpro.splitter.controller.command.WriteOffCommand;
import de.cofinpro.splitter.io.ConsolePrinter;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
Expand All @@ -29,21 +29,13 @@
* date recognition if given as optional 1st parameter and the command recognition and split / hand over of arguments.
*/
@Component
@RequiredArgsConstructor
public class CommandLineInterpreter {

private final Scanner scanner;
private final ConsolePrinter printer;
private final DateTimeFormatter dateTimeFormatter;

@Autowired
public CommandLineInterpreter(Scanner scanner,
ConsolePrinter printer,
DateTimeFormatter dateTimeFormatter) {
this.scanner = scanner;
this.printer = printer;
this.dateTimeFormatter = dateTimeFormatter;
}

/**
* core method of the CommandLineInterpreter that parses the next user input line by use of the given scanner (bean).
* It recognizes the defined commands and creates and returns a new Command. If not recognized, an UnknownCommand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.cofinpro.splitter.controller.command.LineCommand;
import de.cofinpro.splitter.model.Repositories;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
Expand All @@ -18,18 +18,12 @@
havingValue = "true",
matchIfMissing = true)
@Component
@RequiredArgsConstructor
public class SplitterCommandLineRunner implements CommandLineRunner {

private final CommandLineInterpreter commandLineInterpreter;
private final Repositories repositories;

@Autowired
public SplitterCommandLineRunner(CommandLineInterpreter commandLineInterpreter,
Repositories repositories) {
this.commandLineInterpreter = commandLineInterpreter;
this.repositories = repositories;
}

@Override
public void run(String... args) {
LineCommand command = commandLineInterpreter.parseNext();
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/de/cofinpro/splitter/model/Repositories.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import de.cofinpro.splitter.persistence.PersonRepository;
import de.cofinpro.splitter.persistence.TransactionRepository;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
Expand All @@ -19,12 +18,4 @@ public class Repositories {
private final TransactionRepository transactionRepository;
private final GroupRepository groupRepository;
private final PersonRepository personRepository;

@Autowired
public Repositories(TransactionRepository transactionRepository, GroupRepository groupRepository,
PersonRepository personRepository) {
this.transactionRepository = transactionRepository;
this.groupRepository = groupRepository;
this.personRepository = personRepository;
}
}

0 comments on commit 9d2a99f

Please sign in to comment.