Я хочу создать консольное приложение spring (выполняется из командной строки с maven, например: mvn exec: java -Dexec.mainclass= "package.MainClass" ).
Является ли это приложение, я хочу иметь какие-то службы и уровни dao. Я знаю, как это сделать для веб-приложения, но я не нашел никакой информации о том, как это сделать в случае консольного приложения (возможно, с Swing).
Я пытаюсь создать что-то вроде:
public interface SampleService {
public String getHelloWorld();
}
@Service
public class SampleServiceImpl implements SampleService {
public String getHelloWorld() {
return "HelloWorld from Service!";
}
}
public class Main {
@Autowired
SampleService sampleService;
public static void main(String [] args) {
Main main = new Main();
main.sampleService.getHelloWorld();
}
}
Возможно ли это? Могу ли я найти пример того, как это сделать?