From 8f4112b389b769e9e5763ba6fc726d7a0a78f8dd Mon Sep 17 00:00:00 2001 From: Adsu Date: Sat, 10 Oct 2020 19:57:55 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=83=20adicionando=20spring=20rest=20ba?= =?UTF-8?q?sico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 14 ++++++++++++-- src/main/java/sacip/Launcher.java | 17 +++++++++++++++++ src/main/java/sacip/launch/Launcher.java | 13 ------------- src/main/java/sacip/rest/RestInterface.java | 15 +++++++++++++++ src/test/java/sacip/AppTest.java | 2 +- 5 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 src/main/java/sacip/Launcher.java delete mode 100644 src/main/java/sacip/launch/Launcher.java create mode 100644 src/main/java/sacip/rest/RestInterface.java diff --git a/build.gradle b/build.gradle index 27c1971..8fcaced 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,14 @@ plugins { // Apply the application plugin to add support for building a CLI application. id 'application' + + id 'org.springframework.boot' version '2.3.4.RELEASE' + id 'io.spring.dependency-management' version '1.0.10.RELEASE' +} + +configurations { + all*.exclude module : 'spring-boot-starter-logging' + //all*.exclude module : 'logback-classic' } repositories { @@ -28,10 +36,12 @@ dependencies { implementation 'com.google.guava:guava:29.0-jre' implementation 'br.com.smartechnology.midas:agent-server:1.2.0' + // https://mvnrepository.com/artifact/org.neo4j.driver/neo4j-java-driver - compile group: 'org.neo4j.driver', name: 'neo4j-java-driver', version: '4.1.1' + implementation 'org.neo4j.driver:neo4j-java-driver:4.1.1' + implementation 'org.springframework.boot:spring-boot-starter-web' // Use JUnit test framework testImplementation 'junit:junit:4.13' @@ -39,5 +49,5 @@ dependencies { application { // Define the main class for the application. - mainClassName = 'sacip.launch.Launcher' + mainClassName = 'sacip.Launcher' } diff --git a/src/main/java/sacip/Launcher.java b/src/main/java/sacip/Launcher.java new file mode 100644 index 0000000..c072eff --- /dev/null +++ b/src/main/java/sacip/Launcher.java @@ -0,0 +1,17 @@ +package sacip; + +import org.midas.as.AgentServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Launcher { + public static void main(String[] args) + { + // Inicializando Arquitetura via C�digo + // (não mostra a tela de gerenciamento) + System.out.println("testes"); + AgentServer.initialize(true, true); + SpringApplication.run(Launcher.class, args); + } +} \ No newline at end of file diff --git a/src/main/java/sacip/launch/Launcher.java b/src/main/java/sacip/launch/Launcher.java deleted file mode 100644 index 7a7d644..0000000 --- a/src/main/java/sacip/launch/Launcher.java +++ /dev/null @@ -1,13 +0,0 @@ -package sacip.launch; - -import org.midas.as.AgentServer; - -public class Launcher { - public static void main(String[] args) - { - // Inicializando Arquitetura via C�digo - // (não mostra a tela de gerenciamento) - System.out.println("teste"); - AgentServer.initialize(true, true); - } -} \ No newline at end of file diff --git a/src/main/java/sacip/rest/RestInterface.java b/src/main/java/sacip/rest/RestInterface.java new file mode 100644 index 0000000..7b5da25 --- /dev/null +++ b/src/main/java/sacip/rest/RestInterface.java @@ -0,0 +1,15 @@ +package sacip.rest; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RestInterface { + + private String test = "HELLO WORLD"; + + @GetMapping("/test") + public String test(String name) { + return test; + } +} diff --git a/src/test/java/sacip/AppTest.java b/src/test/java/sacip/AppTest.java index 5741581..64137c8 100644 --- a/src/test/java/sacip/AppTest.java +++ b/src/test/java/sacip/AppTest.java @@ -5,7 +5,7 @@ import org.junit.Test; -import sacip.launch.Launcher; +import sacip.Launcher; import static org.junit.Assert.*;