From 810572162a94fa1d2c85aac6654e49a08b954240 Mon Sep 17 00:00:00 2001 From: "andrea.terzani" Date: Thu, 10 Oct 2024 15:41:11 +0200 Subject: [PATCH] Update dependencies and enable Feign client --- pom.xml | 30 +++++++++++-------- .../olympus/hermione/HermioneApplication.java | 4 ++- .../ApplicationBrowserController.java | 23 ++++++++++++++ .../hermione/services/SourceCodeService.java | 18 +++++++++++ 4 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/olympus/hermione/controllers/ApplicationBrowserController.java create mode 100644 src/main/java/com/olympus/hermione/services/SourceCodeService.java diff --git a/pom.xml b/pom.xml index 0836f53..8d8166d 100644 --- a/pom.xml +++ b/pom.xml @@ -29,12 +29,10 @@ 21 1.0.0-SNAPSHOT + 2023.0.3 - - - org.springframework.boot spring-boot-starter-data-mongodb @@ -89,16 +87,14 @@ spring-boot-starter-security - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - 4.1.3 - + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + org.springframework.cloud - spring-cloud-starter-feign - 1.4.7.RELEASE + spring-cloud-starter-openfeign @@ -115,11 +111,12 @@ com.olympus - olympus-common + common 1.0 - + + @@ -129,7 +126,14 @@ pom import - + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + diff --git a/src/main/java/com/olympus/hermione/HermioneApplication.java b/src/main/java/com/olympus/hermione/HermioneApplication.java index 25f53ef..2ed5d07 100644 --- a/src/main/java/com/olympus/hermione/HermioneApplication.java +++ b/src/main/java/com/olympus/hermione/HermioneApplication.java @@ -2,9 +2,11 @@ package com.olympus.hermione; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication +@SpringBootApplication(scanBasePackages = {"com.olympus.hermione", "com.olympus"}) +@EnableFeignClients(basePackages = "com.olympus.feign") @EnableAsync public class HermioneApplication { diff --git a/src/main/java/com/olympus/hermione/controllers/ApplicationBrowserController.java b/src/main/java/com/olympus/hermione/controllers/ApplicationBrowserController.java new file mode 100644 index 0000000..cd139eb --- /dev/null +++ b/src/main/java/com/olympus/hermione/controllers/ApplicationBrowserController.java @@ -0,0 +1,23 @@ +package com.olympus.hermione.controllers; + +import com.olympus.dto.TreeNode; +import com.olympus.feign.SourceCodeModule; +import com.olympus.hermione.services.SourceCodeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + + + +@RestController +public class ApplicationBrowserController { + + @Autowired + SourceCodeService sourceCodeService; + + @GetMapping + public TreeNode getApplicationNode(String applicationName){ + return sourceCodeService.getApplicationNode(applicationName); + } + +} diff --git a/src/main/java/com/olympus/hermione/services/SourceCodeService.java b/src/main/java/com/olympus/hermione/services/SourceCodeService.java new file mode 100644 index 0000000..fa44588 --- /dev/null +++ b/src/main/java/com/olympus/hermione/services/SourceCodeService.java @@ -0,0 +1,18 @@ +package com.olympus.hermione.services; + +import com.olympus.dto.TreeNode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.olympus.feign.SourceCodeModule; + +@Service +public class SourceCodeService { + + @Autowired + private SourceCodeModule sourceCodeModule; + + public TreeNode getApplicationNode(String applicationName) { + return sourceCodeModule.getTreeFromNode(applicationName,"application"); + } + +}