Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea
/target
/target
/*.log
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-starter</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ru/graff/Main.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package ru.graff;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import ru.graff.service.TestingService;

@SpringBootApplication
public class Main {

public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Main.class);
TestingService testingService = context.getBean(TestingService.class);
testingService.startTest();
SpringApplication.run(Main.class);
// ApplicationContext context = SpringApplication.run(Main.class, args);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Закоменченный код лучше не оставлять

// TestingService testingService = context.getBean(TestingService.class);
// testingService.startTest();
}

}
2 changes: 0 additions & 2 deletions src/main/java/ru/graff/dao/TestingDaoSimple.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ru.graff.dao;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Repository;
import ru.graff.domain.Question;

Expand All @@ -12,7 +11,6 @@
import java.util.List;
import java.util.Locale;

@PropertySource("classpath:application.yml")
@Repository
public class TestingDaoSimple implements TestingDao {

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/ru/graff/service/TestingServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
import ru.graff.dao.PersonDao;
import ru.graff.dao.TestingDao;
Expand All @@ -11,7 +10,6 @@
import java.util.Locale;
import java.util.Scanner;

@PropertySource("classpath:application.yml")
@Service
public class TestingServiceImpl implements TestingService {

Expand All @@ -20,7 +18,7 @@ public class TestingServiceImpl implements TestingService {
private final PersonDao personDao;
private final TestingDao testingDao;

public TestingServiceImpl(@Value("${locale}")String locale, MessageSource messageSource, PersonDao personDao, TestingDao testingDao) {
public TestingServiceImpl(@Value("${application.locale}")String locale, MessageSource messageSource, PersonDao personDao, TestingDao testingDao) {
this.messageSource = messageSource;
this.personDao = personDao;
this.testingDao = testingDao;
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/ru/graff/shell/StartTestCommands.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ru.graff.shell;

import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import ru.graff.service.TestingService;

@ShellComponent
public class StartTestCommands {

private final TestingService service;

public StartTestCommands(TestingService service) {
this.service = service;
}

@ShellMethod("Translate text from one language to another.")
public void startTest() {
service.startTest();
}

}
9 changes: 5 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
locale: RU
file.path: tests_ru.csv
#locale: EN
#file.path: tests.csv
application:
locale: EN #ENRU

file:
path: tests.csv #tests_ru.csv